注释类型 AfterTestClass
@Retention(RUNTIME) @Target({METHOD,ANNOTATION_TYPE}) @Documented @EventListener(AfterTestClassEvent.class) public @interface AfterTestClass
@EventListener
annotation used to consume aAfterTestClassEvent
published by theEventPublishingTestExecutionListener
.This annotation may be used on
@EventListener
-compliant methods within a Spring testApplicationContext
— for example, on methods in a@Configuration
class. A method annotated with this annotation will be invoked as part of theTestExecutionListener.afterTestClass(org.springframework.test.context.TestContext)
lifecycle.Event processing can optionally be made conditional via a SpEL expression — for example,
@AfterTestClass("event.testContext.testClass.name matches '.+IntegrationTests'")
.The
EventPublishingTestExecutionListener
must be registered in order for this annotation to have an effect — for example, via@TestExecutionListeners
.- 从以下版本开始:
- 5.2
- 作者:
- Frank Scheffler, Sam Brannen
- 另请参阅:
AfterTestClassEvent
可选元素概要
可选元素 修饰符和类型 可选元素 说明 String
value
Alias forEventListener.condition()
.
元素详细资料
value
@AliasFor(annotation=EventListener.class, attribute="condition") String value
Alias forEventListener.condition()
.- 默认值:
- ""