use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext in project spring-boot by spring-projects.
the class MappingsEndpointTests method prepareContextSupplier.
@SuppressWarnings("unchecked")
private Supplier<ConfigurableWebApplicationContext> prepareContextSupplier() {
ServletContext servletContext = mock(ServletContext.class);
given(servletContext.getInitParameterNames()).willReturn(Collections.emptyEnumeration());
given(servletContext.getAttributeNames()).willReturn(Collections.emptyEnumeration());
FilterRegistration filterRegistration = mock(FilterRegistration.class);
given((Map<String, FilterRegistration>) servletContext.getFilterRegistrations()).willReturn(Collections.singletonMap("testFilter", filterRegistration));
ServletRegistration servletRegistration = mock(ServletRegistration.class);
given((Map<String, ServletRegistration>) servletContext.getServletRegistrations()).willReturn(Collections.singletonMap("testServlet", servletRegistration));
return () -> {
AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext();
context.setServletContext(servletContext);
return context;
};
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext in project spring-boot by spring-projects.
the class FreeMarkerAutoConfigurationServletIntegrationTests method load.
private void load(Class<?> config, String... env) {
this.context = new AnnotationConfigServletWebApplicationContext();
this.context.setServletContext(new MockServletContext());
TestPropertyValues.of(env).applyTo(this.context);
this.context.register(config);
this.context.refresh();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext in project spring-boot by spring-projects.
the class HypermediaAutoConfigurationWithoutJacksonTests method jacksonRelatedConfigurationBacksOff.
@Test
void jacksonRelatedConfigurationBacksOff() {
this.context = new AnnotationConfigServletWebApplicationContext();
this.context.register(BaseConfig.class);
this.context.setServletContext(new MockServletContext());
this.context.refresh();
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext in project spring-boot by spring-projects.
the class RepositoryRestMvcAutoConfigurationTests method load.
private void load(Class<?> config, String... environment) {
AnnotationConfigServletWebApplicationContext applicationContext = new AnnotationConfigServletWebApplicationContext();
applicationContext.setServletContext(new MockServletContext());
applicationContext.register(config, BaseConfiguration.class);
TestPropertyValues.of(environment).applyTo(applicationContext);
applicationContext.refresh();
this.context = applicationContext;
}
use of org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext in project spring-boot by spring-projects.
the class HttpEncodingAutoConfigurationTests method doLoad.
private AnnotationConfigServletWebApplicationContext doLoad(Class<?>[] configs, String... environment) {
AnnotationConfigServletWebApplicationContext applicationContext = new AnnotationConfigServletWebApplicationContext();
TestPropertyValues.of(environment).applyTo(applicationContext);
applicationContext.register(configs);
applicationContext.register(MinimalWebAutoConfiguration.class, HttpEncodingAutoConfiguration.class);
applicationContext.setServletContext(new MockServletContext());
applicationContext.refresh();
return applicationContext;
}
Aggregations