@Retention(value=RUNTIME) @Target(value={METHOD,ANNOTATION_TYPE}) @Documented @EventListener(value=BeforeTestExecutionEvent.class) public @interface BeforeTestExecution
@EventListener
annotation used to consume a
BeforeTestExecution
published by the
EventPublishingTestExecutionListener
.
This annotation may be used on @EventListener
-compliant methods within
a Spring test ApplicationContext
— for example, on methods in a
@Configuration
class. A method annotated with this annotation will be invoked as part of the
TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)
lifecycle.
Event processing can optionally be made conditional via
a SpEL expression — for example,
@BeforeTestExecution("event.testContext.testMethod.name matches 'test.*'")
.
The EventPublishingTestExecutionListener
must be registered in order
for this annotation to have an effect — for example, via
@TestExecutionListeners
.
BeforeTestExecutionEvent
Modifier and Type | Optional Element and Description |
---|---|
String |
value
Alias for
EventListener.condition() . |
@AliasFor(annotation=EventListener.class, attribute="condition") public abstract String value
EventListener.condition()
.