下面列出了怎么用org.springframework.boot.web.embedded.undertow.UndertowDeploymentInfoCustomizer的API类实例代码及写法,或者点击链接到github查看源代码。
@Test
void customize() throws IOException {
UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
this.jsfUndertowFactoryCustomizer.customize(factory);
UndertowDeploymentInfoCustomizer undertowDeploymentInfoCustomizer
= factory.getDeploymentInfoCustomizers().iterator().next();
DeploymentInfo deploymentInfo = new DeploymentInfo();
deploymentInfo.setClassLoader(this.getClass().getClassLoader());
undertowDeploymentInfoCustomizer.customize(deploymentInfo);
assertThat(deploymentInfo.getResourceManager().getResource("testUndertow.txt"))
.isNotNull();
}
@Bean
@Autowired
public UndertowServletWebServerFactory embeddedServletContainerFactory(List<UndertowDeploymentInfoCustomizer> customizers) {
UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
for (UndertowDeploymentInfoCustomizer customizer : customizers) {
factory.addDeploymentInfoCustomizers(customizer);
}
return factory;
}
@Bean @Qualifier("httpTracingCustomizer") UndertowDeploymentInfoCustomizer httpTracingCustomizer(
HttpTracing httpTracing) {
TracingHttpHandler.Wrapper result = new TracingHttpHandler.Wrapper(httpTracing);
return info -> info.addInitialHandlerChainWrapper(result);
}
@Bean
@ConditionalOnClass(name = {"io.undertow.Undertow"})
public UndertowDeploymentInfoCustomizer undertowKeycloakContextCustomizer() {
return new KeycloakUndertowDeploymentInfoCustomizer(keycloakProperties);
}