use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class WebServicesAutoConfigurationTests method load.
private void load(Class<?> config, String... environment) {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setServletContext(new MockServletContext());
EnvironmentTestUtils.addEnvironment(context, environment);
context.register(config);
context.refresh();
this.context = context;
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class ConditionalOnNotWebApplicationTests method testNotWebApplicationWithServletContext.
@Test
public void testNotWebApplicationWithServletContext() {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(NotWebApplicationConfiguration.class);
ctx.setServletContext(new MockServletContext());
ctx.refresh();
this.context = ctx;
assertThat(this.context.getBeansOfType(String.class)).isEmpty();
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class SpringDataWebAutoConfigurationTests method webSupportIsAutoConfiguredInWebApplicationContexts.
@Test
public void webSupportIsAutoConfiguredInWebApplicationContexts() {
this.context = new AnnotationConfigWebApplicationContext();
((AnnotationConfigWebApplicationContext) this.context).register(SpringDataWebAutoConfiguration.class);
this.context.refresh();
((AnnotationConfigWebApplicationContext) this.context).setServletContext(new MockServletContext());
Map<String, PageableHandlerMethodArgumentResolver> beans = this.context.getBeansOfType(PageableHandlerMethodArgumentResolver.class);
assertThat(beans).hasSize(1);
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class Neo4jDataAutoConfigurationTests method load.
private void load(Class<?> config, String... environment) {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
EnvironmentTestUtils.addEnvironment(ctx, environment);
if (config != null) {
ctx.register(config);
}
ctx.register(PropertyPlaceholderAutoConfiguration.class, TransactionAutoConfiguration.class, Neo4jDataAutoConfiguration.class);
ctx.refresh();
this.context = ctx;
}
use of org.springframework.web.context.support.AnnotationConfigWebApplicationContext in project spring-boot by spring-projects.
the class HypermediaAutoConfigurationTests method linkDiscoverersCreated.
@Test
public void linkDiscoverersCreated() throws Exception {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(BaseConfig.class);
this.context.refresh();
LinkDiscoverers discoverers = this.context.getBean(LinkDiscoverers.class);
assertThat(discoverers).isNotNull();
LinkDiscoverer discoverer = discoverers.getLinkDiscovererFor(MediaTypes.HAL_JSON);
assertThat(HalLinkDiscoverer.class.isInstance(discoverer)).isTrue();
}
Aggregations