use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class SecurityAutoConfigurationTests method testDisableIgnoredStaticApplicationPaths.
@Test
public void testDisableIgnoredStaticApplicationPaths() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(SecurityAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none");
this.context.refresh();
// Just the application endpoints now
assertThat(this.context.getBean(FilterChainProxy.class).getFilterChains()).hasSize(1);
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class SecurityFilterAutoConfigurationTests method filterAutoConfigurationWorksWithoutSecurityAutoConfiguration.
@Test
public void filterAutoConfigurationWorksWithoutSecurityAutoConfiguration() throws Exception {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setServletContext(new MockServletContext());
try {
context.register(Config.class);
context.refresh();
} finally {
context.close();
}
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class AbstractJpaAutoConfigurationTests method testOpenEntityManagerInViewInterceptorNotRegisteredWhenExplicitlyOff.
@Test
public void testOpenEntityManagerInViewInterceptorNotRegisteredWhenExplicitlyOff() throws Exception {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
EnvironmentTestUtils.addEnvironment(context, "spring.jpa.open_in_view:false");
context.register(TestConfiguration.class, EmbeddedDataSourceConfiguration.class, PropertyPlaceholderAutoConfiguration.class, getAutoConfigureClass());
context.refresh();
assertThat(getInterceptorBeans(context).length).isEqualTo(0);
context.close();
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class SitePreferenceAutoConfigurationTests method sitePreferenceHandlerInterceptorCreated.
@Test
public void sitePreferenceHandlerInterceptorCreated() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.register(SitePreferenceAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class)).isNotNull();
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class SitePreferenceAutoConfigurationTests method sitePreferenceMethodArgumentResolverEnabled.
@Test
public void sitePreferenceMethodArgumentResolverEnabled() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.mobile.sitepreference.enabled:true");
this.context.register(SitePreferenceAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class)).isNotNull();
}
Aggregations