spring-framework/framework-docs/modules/ROOT/pages
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
..
core Merge branch '6.0.x' 2023-09-10 14:37:01 +02:00
data-access Stop referring to JDO and outdated JDBC versions in documentation 2023-09-07 13:26:38 +02:00
integration Reference documentation for `RestClient` 2023-09-07 14:28:56 +02:00
languages Polishing 2023-09-08 19:29:28 +02:00
testing Support parameter injection in @[Before|After]Transaction methods 2023-09-10 20:15:26 +02:00
web Merge branch '6.0.x' 2023-09-08 10:07:35 +01:00
appendix.adoc Fail on error by default during test AOT processing 2023-08-03 10:59:46 +03:00
attributes.adoc Migrate Structure 2023-05-04 15:35:05 +01:00
core.adoc Remove includes 2023-05-04 15:35:05 +01:00
data-access.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
index.adoc Update reference documentation index 2023-06-14 08:49:52 +02:00
integration.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
languages.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
overview.adoc Remove includes 2023-05-04 15:35:05 +01:00
page-layout.adoc Remove unnecessary asciidoc attributes 2023-05-04 15:35:05 +01:00
rsocket.adoc Merge branch '6.0.x' 2023-08-22 16:57:37 +02:00
testing.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00
web-reactive.adoc Structural Fixes 2023-05-04 15:35:05 +01:00
web.adoc Enable Section Summary TOC for small pages 2023-05-04 15:35:05 +01:00