@Enable registrars called with correct metadata when placed on superclass

Issue: SPR-11251
This commit is contained in:
Juergen Hoeller
2013-12-23 23:07:59 +01:00
parent e08f743301
commit ecee20f1fe
2 changed files with 28 additions and 14 deletions

View File

@@ -52,6 +52,17 @@ public class EnableTransactionManagementTests {
assertThat("Stereotype annotation not visible", services.containsKey("testBean"), is(true));
}
@Test
public void transactionProxyIsCreatedWithEnableOnSuperclass() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(InheritedEnableTxConfig.class, TxManagerConfig.class);
ctx.refresh();
TransactionalTestBean bean = ctx.getBean(TransactionalTestBean.class);
assertThat("testBean is not a proxy", AopUtils.isAopProxy(bean), is(true));
Map<?,?> services = ctx.getBeansWithAnnotation(Service.class);
assertThat("Stereotype annotation not visible", services.containsKey("testBean"), is(true));
}
@Test
public void txManagerIsResolvedOnInvocationOfTransactionalMethod() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
@@ -97,6 +108,11 @@ public class EnableTransactionManagementTests {
}
@Configuration
static class InheritedEnableTxConfig extends EnableTxConfig {
}
@Configuration
@EnableTransactionManagement(mode=AdviceMode.ASPECTJ)
static class EnableAspectJTxConfig {