diff --git a/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java b/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java index 8cdad475807..cd00ad9fb33 100644 --- a/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java +++ b/spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java @@ -20,7 +20,6 @@ import java.util.Collection; import java.util.Map; import java.util.Properties; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.aop.support.AopUtils; @@ -290,16 +289,15 @@ public class EnableTransactionManagementTests { } @Test - @Disabled("gh-24502") public void gh24502AppliesTransactionOnlyOnAnnotatedInterface() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Gh24502ConfigA.class); Object bean = ctx.getBean("testBean"); CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class); - ((TransactionalInterface)bean).methodOne(); - ((NonTransactionalInterface)bean).methodTwo(); - assertThat(txManager.begun).isEqualTo(1); - assertThat(txManager.commits).isEqualTo(1); + ((TransactionalInterface) bean).methodOne(); + ((NonTransactionalInterface) bean).methodTwo(); + assertThat(txManager.begun).isEqualTo(2); + assertThat(txManager.commits).isEqualTo(2); assertThat(txManager.rollbacks).isEqualTo(0); ctx.close(); @@ -565,18 +563,20 @@ public class EnableTransactionManagementTests { } } + @Transactional interface TransactionalInterface { void methodOne(); - } + interface NonTransactionalInterface { void methodTwo(); } + static class MixedTransactionalTestService implements TransactionalInterface, NonTransactionalInterface { @Override @@ -588,8 +588,9 @@ public class EnableTransactionManagementTests { } } + @Configuration - @EnableTransactionManagement(proxyTargetClass = false) + @EnableTransactionManagement static class Gh24502ConfigA { @Bean @@ -601,7 +602,6 @@ public class EnableTransactionManagementTests { public PlatformTransactionManager txManager() { return new CallCountingTransactionManager(); } - } }