spring-framework/framework-docs/modules/ROOT
Sam Brannen ed83461021 Support parameter injection in @[Before|After]Transaction methods
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
2023-09-10 20:15:26 +02:00
..
assets/images Migrate Structure 2023-05-04 15:35:05 +01:00
examples Use include-code Macro 2023-05-04 15:35:05 +01:00
pages Support parameter injection in @[Before|After]Transaction methods 2023-09-10 20:15:26 +02:00
partials/web Update documentation for data binding improvements 2023-08-02 17:21:33 +03:00
nav.adoc Document method validation improvements 2023-07-05 17:07:30 +01:00