且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

同时运行带有 SSL 和未加密的 Spring Boot 应用程序(嵌入式 Tomcat)

更新时间:2023-09-17 08:31:40

TomcatConnectorCustomizer 仅修改现有的 Connector(名称中的线索).要添加其他连接器,您只需要一个不同的 API(例如 这里),例如(从样本中复制):

A TomcatConnectorCustomizer only modifies the existing Connector (clue in the name). To add additional connectors you just need a different API (example here), e.g. (copied from the sample):

@Bean
public EmbeddedServletContainerFactory servletContainer() {
    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
    tomcat.addAdditionalTomcatConnectors(createConnector());
    return tomcat;
}