use of org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ControllerEndpointWebFluxIntegrationTests method endpointsCanBeAccessed.
@Test
void endpointsCanBeAccessed() {
TestSecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("user", "N/A", "ROLE_ACTUATOR"));
this.context = new AnnotationConfigReactiveWebApplicationContext();
this.context.register(DefaultConfiguration.class, ExampleController.class);
TestPropertyValues.of("management.endpoints.web.exposure.include=*").applyTo(this.context);
this.context.refresh();
WebTestClient webClient = WebTestClient.bindToApplicationContext(this.context).build();
webClient.get().uri("/actuator/example").exchange().expectStatus().isOk();
}
use of org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ConditionalOnWebApplicationTests method testWebApplicationWithReactiveContext.
@Test
void testWebApplicationWithReactiveContext() {
AnnotationConfigReactiveWebApplicationContext context = new AnnotationConfigReactiveWebApplicationContext();
context.register(AnyWebApplicationConfiguration.class, ServletWebApplicationConfiguration.class, ReactiveWebApplicationConfiguration.class);
context.refresh();
this.context = context;
assertThat(this.context.getBeansOfType(String.class)).containsExactly(entry("any", "any"), entry("reactive", "reactive"));
}
use of org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method nettyServerCustomizerBeanIsAddedToFactory.
@Test
void nettyServerCustomizerBeanIsAddedToFactory() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withClassLoader(new FilteredClassLoader(Tomcat.class, Server.class, Undertow.class)).withUserConfiguration(NettyServerCustomizerConfiguration.class, HttpHandlerConfiguration.class).run((context) -> {
NettyReactiveWebServerFactory factory = context.getBean(NettyReactiveWebServerFactory.class);
assertThat(factory.getServerCustomizers()).hasSize(1);
});
}
use of org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebApplicationContext 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.reactive.context.AnnotationConfigReactiveWebApplicationContext in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method undertowBuilderCustomizerBeanIsAddedToFactory.
@Test
void undertowBuilderCustomizerBeanIsAddedToFactory() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withClassLoader(new FilteredClassLoader(Tomcat.class, HttpServer.class, Server.class)).withUserConfiguration(UndertowBuilderCustomizerConfiguration.class, HttpHandlerConfiguration.class).run((context) -> {
UndertowReactiveWebServerFactory factory = context.getBean(UndertowReactiveWebServerFactory.class);
assertThat(factory.getBuilderCustomizers()).hasSize(1);
});
}
Aggregations