use of io.micronaut.http.server.netty.NettyEmbeddedServer in project micronaut-core by micronaut-projects.
the class SecondaryNettyServer method nettyEmbeddedServer.
@Named(SERVER_ID)
@Context
// <2>
@Bean(preDestroy = "close")
@Requires(beans = Environment.class)
NettyEmbeddedServer nettyEmbeddedServer(NettyEmbeddedServerFactory serverFactory) {
// <3>
// configure server programmatically
final NettyHttpServerConfiguration configuration = // <4>
new NettyHttpServerConfiguration();
// <5>
final ServerSslConfiguration sslConfiguration = new ServerSslConfiguration();
sslConfiguration.setBuildSelfSigned(true);
sslConfiguration.setEnabled(true);
// random port
sslConfiguration.setPort(-1);
// <6>
final NettyEmbeddedServer embeddedServer = serverFactory.build(configuration, sslConfiguration);
// <7>
embeddedServer.start();
// <8>
return embeddedServer;
}
Aggregations