use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnvironmentSystemIntegrationTests method annotationConfigApplicationContext_withProdEnvAndProdConfigClass.
@Test
public void annotationConfigApplicationContext_withProdEnvAndProdConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.register(ProdConfig.class);
ctx.refresh();
assertThat("should have prod bean", ctx.containsBean(PROD_BEAN_NAME), is(true));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnvironmentSystemIntegrationTests method annotationConfigApplicationContext_withDevEnvAndDevConfigClass.
@Test
public void annotationConfigApplicationContext_withDevEnvAndDevConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(devEnv);
ctx.register(DevConfig.class);
ctx.refresh();
assertThat("should have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(true));
assertThat("should have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(true));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class AnnotatedServiceWithoutInterface method annotatedService_PTC_false.
@Test
public void annotatedService_PTC_false() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCFalse.class, NonAnnotatedServiceImpl.class);
ctx.refresh();
AnnotatedService s = ctx.getBean(AnnotatedService.class);
assertTrue("expected a jdk proxy", AopUtils.isJdkDynamicProxy(s));
assertThat(s, not(instanceOf(NonAnnotatedServiceImpl.class)));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class AnnotatedServiceWithoutInterface method annotatedServiceWithoutInterface_PTC_true.
@Test
public void annotatedServiceWithoutInterface_PTC_true() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(PTCTrue.class, AnnotatedServiceWithoutInterface.class);
ctx.refresh();
AnnotatedServiceWithoutInterface s = ctx.getBean(AnnotatedServiceWithoutInterface.class);
assertTrue("expected a subclass proxy", AopUtils.isCglibProxy(s));
assertThat(s, instanceOf(AnnotatedServiceWithoutInterface.class));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project camel by apache.
the class MongoDbSpringDslOperationsTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
applicationContext = new AnnotationConfigApplicationContext(MongoBasicOperationsConfiguration.class);
CamelContext ctx = SpringCamelContext.springCamelContext(applicationContext);
return ctx;
}
Aggregations