Running A Spring Boot App (Embedded Tomcat) with SSL and Unencrypted Simultaneously

后端 未结 1 794
闹比i
闹比i 2021-01-23 18:31

Is there a way to run a Spring Boot application (runnable war) so that it listens on two ports - one with SSL and one without SSL. I am using an embedded Tomcat 8.

SSL i

1条回答
  •  走了就别回头了
    2021-01-23 19:35

    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;
    }
    

    0 讨论(0)
提交回复
热议问题