use of org.springframework.boot.web.embedded.jetty.JettyReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method jettyServerCustomizerBeanIsAddedToFactory.
@Test
void jettyServerCustomizerBeanIsAddedToFactory() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withClassLoader(new FilteredClassLoader(Tomcat.class, HttpServer.class)).withUserConfiguration(JettyServerCustomizerConfiguration.class, HttpHandlerConfiguration.class).run((context) -> {
JettyReactiveWebServerFactory factory = context.getBean(JettyReactiveWebServerFactory.class);
assertThat(factory.getServerCustomizers()).hasSize(1);
});
}
use of org.springframework.boot.web.embedded.jetty.JettyReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method jettyServerCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce.
@Test
void jettyServerCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withClassLoader(new FilteredClassLoader(Tomcat.class, HttpServer.class)).withUserConfiguration(DoubleRegistrationJettyServerCustomizerConfiguration.class, HttpHandlerConfiguration.class).withPropertyValues("server.port=0").run((context) -> {
JettyReactiveWebServerFactory factory = context.getBean(JettyReactiveWebServerFactory.class);
JettyServerCustomizer customizer = context.getBean("serverCustomizer", JettyServerCustomizer.class);
assertThat(factory.getServerCustomizers()).contains(customizer);
then(customizer).should().customize(any(Server.class));
});
}
Aggregations