Skip to content

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

Closed

Description

@spring-projects-issues

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.

Deliverables

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

Issue Links:

Referenced from: commits ff38224, 0f6711f

Activity

  1. spring-projects-issues commented on May 3, 2016

    @spring-projects-issues
    CollaboratorAuthor

    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.

  2. added
    in: test
    type: enhancement
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: testtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions