Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @BeforeTransaction and @AfterTransaction on interface default methods [SPR-14183] #18754

spring-issuemaster opened this issue Apr 17, 2016 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Apr 17, 2016

Sam Brannen opened SPR-14183 and commented

Status Quo

Java 8 introduced support for interface default methods. JUnit 5 as well as some existing Runner implementations for JUnit 4.x already support default methods in various scenarios -- for example, @Test, @BeforeEach, etc. However, the Spring TestContext Framework does not yet support the declaration of @BeforeTransaction and @AfterTransaction on default methods: it simply does not find them.


  1. Update the annotated method search algorithms in TransactionalTestExecutionListener so that @BeforeTransaction and @AfterTransaction can be declared on interface default methods.

Issue Links:

  • #17419 Make ReflectionUtils.doWithMethods work on Java 8 default interface methods
  • #18755 Support test annotations on interfaces

Referenced from: commits ff38224, 0f6711f

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 3, 2016

Sam Brannen commented

Completed in GitHub commit 0f6711f:

Support @[Before|After]Transaction on default methods

Prior to this commit, @BeforeTransaction and @AfterTransaction could
only be declared on methods within test classes. However, JUnit 5 as
well as some existing third-party Runner implementations for JUnit 4
already support Java 8 based interface default methods in various
scenarios -- for example, @Test, @BeforeEach, etc.

This commit brings the Spring TestContext Framework up to date by
supporting the declaration of @BeforeTransaction and @AfterTransaction
on interface default methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.