3232
3333import org .springframework .aop .framework .Advised ;
3434import org .springframework .aop .framework .ProxyFactory ;
35+ import org .springframework .beans .factory .BeanNameAware ;
3536import org .springframework .core .annotation .AliasFor ;
3637import org .springframework .core .annotation .AnnotationUtils ;
3738import org .springframework .core .testfixture .io .SerializationTestUtils ;
@@ -59,6 +60,7 @@ class AnnotationTransactionAttributeSourceTests {
5960
6061 private final AnnotationTransactionAttributeSource attributeSource = new AnnotationTransactionAttributeSource ();
6162
63+
6264 @ Test
6365 void serializable () throws Exception {
6466 TestBean1 tb = new TestBean1 ();
@@ -123,6 +125,10 @@ void transactionAttributeDeclaredOnCglibClassMethod() {
123125 void transactionAttributeDeclaredOnInterfaceMethodOnly () {
124126 TransactionAttribute actual = getTransactionAttribute (TestBean2 .class , ITestBean2 .class , "getAge" );
125127 assertThat (actual ).satisfies (hasNoRollbackRule ());
128+ actual = getTransactionAttribute (TestBean2 .class , ITestBean2X .class , "getAge" );
129+ assertThat (actual ).satisfies (hasNoRollbackRule ());
130+ actual = getTransactionAttribute (ITestBean2X .class , ITestBean2X .class , "getAge" );
131+ assertThat (actual ).satisfies (hasNoRollbackRule ());
126132 }
127133
128134 /**
@@ -249,6 +255,7 @@ void customMethodAttributeWithReadOnlyOverrideOnInterface() {
249255 assertThat (actual .isReadOnly ()).isTrue ();
250256 }
251257
258+
252259 @ Nested
253260 class JtaAttributeTests {
254261
@@ -276,6 +283,7 @@ void transactionAttributeDeclaredOnInterface() {
276283 assertThat (getNameAttr .getPropagationBehavior ()).isEqualTo (TransactionAttribute .PROPAGATION_SUPPORTS );
277284 }
278285
286+
279287 static class JtaAnnotatedBean1 implements ITestBean1 {
280288
281289 private String name ;
@@ -305,7 +313,6 @@ public void setAge(int age) {
305313 }
306314 }
307315
308-
309316 @ jakarta .transaction .Transactional (jakarta .transaction .Transactional .TxType .SUPPORTS )
310317 static class JtaAnnotatedBean2 implements ITestBean1 {
311318
@@ -362,7 +369,6 @@ public void setAge(int age) {
362369 }
363370 }
364371
365-
366372 @ jakarta .transaction .Transactional (jakarta .transaction .Transactional .TxType .SUPPORTS )
367373 interface ITestJta {
368374
@@ -375,9 +381,9 @@ interface ITestJta {
375381
376382 void setName (String name );
377383 }
378-
379384 }
380385
386+
381387 @ Nested
382388 class Ejb3AttributeTests {
383389
@@ -448,7 +454,6 @@ public void setAge(int age) {
448454 }
449455 }
450456
451-
452457 @ jakarta .ejb .TransactionAttribute (TransactionAttributeType .SUPPORTS )
453458 static class Ejb3AnnotatedBean2 implements ITestBean1 {
454459
@@ -506,6 +511,7 @@ public void setAge(int age) {
506511 }
507512 }
508513
514+
509515 @ Nested
510516 class GroovyTests {
511517
@@ -519,6 +525,7 @@ void transactionAttributeDeclaredOnGroovyClass() {
519525 assertThat (attributeSource .getTransactionAttribute (getMetaClassMethod , GroovyTestBean .class )).isNull ();
520526 }
521527
528+
522529 @ Transactional
523530 static class GroovyTestBean implements ITestBean1 , GroovyObject {
524531
@@ -571,6 +578,7 @@ public void setMetaClass(MetaClass metaClass) {
571578 }
572579 }
573580
581+
574582 private Consumer <TransactionAttribute > hasRollbackRules (RollbackRuleAttribute ... rollbackRuleAttributes ) {
575583 return transactionAttribute -> {
576584 RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute ();
@@ -626,7 +634,12 @@ interface ITestBean2 {
626634 }
627635
628636
629- interface ITestBean2X extends ITestBean2 {
637+ interface ITestBean2X extends ITestBean2 , BeanNameAware {
638+
639+ @ Transactional
640+ int getAge ();
641+
642+ void setAge (int age );
630643
631644 String getName ();
632645
@@ -735,6 +748,10 @@ public TestBean2(String name, int age) {
735748 this .age = age ;
736749 }
737750
751+ @ Override
752+ public void setBeanName (String name ) {
753+ }
754+
738755 @ Override
739756 public String getName () {
740757 return name ;
@@ -917,6 +934,7 @@ public int getAge() {
917934 }
918935 }
919936
937+
920938 @ Transactional (label = {"retryable" , "long-running" })
921939 static class TestBean11 {
922940
0 commit comments