Spring loading with berth 9 and ssl

I followed the Spring boot installation and can easily get Tomcat to work with SSL, however I would like to use Jetty, and there is some documentation for this. I can access it JettyEmbeddedServletContainerFactory, but it doesn’t use the same interface methods to access the configuration.

Has anyone managed to configure berth 9 inside Spring boot to use SSL? I found a similar question here and wondered if there was anyone who solved this.

Any help would be great.

+3
source share
2 answers

, , Spring Boot ( , , ) GitHub, . , , . , . , , /.

- .

, , . , API Jetty. Jetty 8 Spring Boot , Jetty 9 .

@Bean
public EmbeddedServletContainerFactory embeddedServletContainerFactory() throws Exception {
    return new JettyEmbeddedServletContainerFactory() {
        @Override
        protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer(
                Server server) {

            SslContextFactory sslContextFactory = new SslContextFactory();
            sslContextFactory.setKeyStorePath("/usr/local/keystore");
            sslContextFactory.setKeyStorePassword("password");
            sslContextFactory.setCertAlias("alias");

            SslSocketConnector sslConnector = new SslSocketConnector(sslContextFactory);
            sslConnector.setPort(8443);
            server.setConnectors(new Connector[] { sslConnector });
            return super.getJettyEmbeddedServletContainer(server);
        }
    };
}
+4

maven ? , pom.xml - http://bghints.blogspot.com/2012/03/client-authentication-with-ssl_28.html

6. 9 . :

org.mortbay.jetty

org.eclipse.jetty

, .

0

All Articles