Prior to this commit, @BeforeTransaction and @AfterTransaction methods could not accept any arguments. This is acceptable with testing frameworks such as JUnit 4 and TestNG that do not provide support for parameter injection. However, users of JUnit Jupiter have become accustomed to being able to accept arguments in lifecycle methods annotated with JUnit's @BeforeEach, @AfterEach, etc. As a follow up to the previous commit (see gh-31199), this commit introduces first-class support for parameter injection in @BeforeTransaction and @AfterTransaction methods, as demonstrated in the following example. @BeforeTransaction void verifyInitialDatabaseState(@Autowired DataSource dataSource) { // Use the DataSource to verify the initial DB state } Closes gh-30736 |
||
---|---|---|
.. | ||
assets/images | ||
examples | ||
pages | ||
partials/web | ||
nav.adoc |