Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
* to be manually registered if you have custom configuration via
* {@link org.springframework.test.context.TestExecutionListeners @TestExecutionListeners}
* that does not include the default listeners.</li>
* <li>Annotate a field of type {@code ApplicationEvents} with
* <li>With JUnit Jupiter, declare a parameter of type {@code ApplicationEvents}
* in a test or lifecycle method. Since {@code ApplicationEvents} is scoped to the
* lifecycle of the current test method, this is the recommended approach.</li>
* <li>Alternatively, you can annotate a field of type {@code ApplicationEvents} with
* {@link org.springframework.beans.factory.annotation.Autowired @Autowired} and
* use that instance of {@code ApplicationEvents} in your test and lifecycle methods.</li>
* <li>With JUnit Jupiter, you may optionally declare a parameter of type
* {@code ApplicationEvents} in a test or lifecycle method as an alternative to
* an {@code @Autowired} field in the test class.</li>
* use that instance of {@code ApplicationEvents} in your test and lifecycle methods.
* Note that {@code ApplicationEvents} is not a general Spring bean and is specifically
* designed for use within test methods.</li>
* </ul>
*
* @author Sam Brannen
Expand Down