- Spring boot 1.5.4
- Undertow
Add the following. switch tomcat to undertow.
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-undertow")
@Configuration
public class ContainerConfig {
@Bean
UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
factory.addBuilderCustomizers(
builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
return factory;
}
}
- Generate keystore.
(rootdir)
keytool -genkey -alias undertow -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
- Add the following to application.yml.
server:
ssl:
key-store: keystore.p12
key-store-password: XXXXX(設定したパスワード)
keyStoreType: PKCS12
keyAlias: undertow
- run
- https://localhost:8080/
- Success if protocol [h2]
Add the following to application.yml
server:
undertow:
accesslog:
enabled: true
pattern: common
# pattern: '%t %a "%r" %s (%D ms)'
rotate: true