use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnableTransactionManagementIntegrationTests method repositoryIsTxProxy_withNonConventionalTxManagerName_fallsBackToByTypeLookup.
// TODO SPR-8207
@Ignore
// TODO SPR-8207
@Test
public void repositoryIsTxProxy_withNonConventionalTxManagerName_fallsBackToByTypeLookup() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, NonConventionalTxManagerNameConfig.class);
ctx.refresh();
assertTxProxying(ctx);
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnableTransactionManagementIntegrationTests method repositoryIsTxProxy_withCustomTxManagerName.
@Test
public void repositoryIsTxProxy_withCustomTxManagerName() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(Config.class, CustomTxManagerNameConfig.class);
ctx.refresh();
assertTxProxying(ctx);
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnableTransactionManagementIntegrationTests method explicitTxManager.
@Test
public void explicitTxManager() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ExplicitTxManagerConfig.class);
ctx.refresh();
FooRepository fooRepository = ctx.getBean(FooRepository.class);
fooRepository.findAll();
CallCountingTransactionManager txManager1 = ctx.getBean("txManager1", CallCountingTransactionManager.class);
assertThat(txManager1.begun, equalTo(1));
assertThat(txManager1.commits, equalTo(1));
assertThat(txManager1.rollbacks, equalTo(0));
CallCountingTransactionManager txManager2 = ctx.getBean("txManager2", CallCountingTransactionManager.class);
assertThat(txManager2.begun, equalTo(0));
assertThat(txManager2.commits, equalTo(0));
assertThat(txManager2.rollbacks, equalTo(0));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnvironmentSystemIntegrationTests method annotationConfigApplicationContext_withImportedConfigClasses.
@Test
public void annotationConfigApplicationContext_withImportedConfigClasses() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
assertHasStandardEnvironment(ctx);
ctx.setEnvironment(prodEnv);
ctx.register(Config.class);
ctx.refresh();
assertEnvironmentAwareInvoked(ctx, prodEnv);
assertThat("should have prod bean", ctx.containsBean(PROD_BEAN_NAME), is(true));
assertThat("should not have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(false));
assertThat("should not have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(false));
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project spring-framework by spring-projects.
the class EnvironmentSystemIntegrationTests method mostSpecificDerivedClassDrivesEnvironment_withDevEnvAndDerivedDevConfigClass.
@Test
public void mostSpecificDerivedClassDrivesEnvironment_withDevEnvAndDerivedDevConfigClass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.setEnvironment(devEnv);
ctx.register(DerivedDevConfig.class);
ctx.refresh();
assertThat("should not have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(false));
assertThat("should not have derived dev bean", ctx.containsBean(DERIVED_DEV_BEAN_NAME), is(false));
assertThat("should not have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(false));
}
Aggregations