Class CommonCachesTestExecutionListener
java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.test.context.support.CommonCachesTestExecutionListener
- All Implemented Interfaces:
Ordered, TestExecutionListener
TestExecutionListener which makes sure that common caches are cleared
once they are no longer required.
Clears the resource caches of the ApplicationContext since they are
only required during the bean initialization phase. Runs after
DirtiesContextTestExecutionListener since dirtying the context will
close it and remove it from the context cache, making it unnecessary to clear
the associated resource caches.
- Since:
- 6.2
- Author:
- Stephane Nicoll
-
Field Summary
FieldsFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterTestClass(TestContext testContext) The default implementation is empty.final intgetOrder()Returns 3005, which ensures that theCommonCachesTestExecutionListeneris ordered after theDirtiesContextTestExecutionListenerand before theTransactionalTestExecutionListener.Methods inherited from class AbstractTestExecutionListener
afterTestExecution, afterTestMethod, beforeTestClass, beforeTestExecution, beforeTestMethod, prepareTestInstance
-
Field Details
-
ORDER
-
-
Constructor Details
-
CommonCachesTestExecutionListener
public CommonCachesTestExecutionListener()
-
-
Method Details
-
getOrder
public final int getOrder()Returns 3005, which ensures that theCommonCachesTestExecutionListeneris ordered after theDirtiesContextTestExecutionListenerand before theTransactionalTestExecutionListener.- Specified by:
getOrderin interfaceOrdered- Overrides:
getOrderin classAbstractTestExecutionListener- Returns:
- the order value
- See Also:
-
afterTestClass
Description copied from class:AbstractTestExecutionListenerThe default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
afterTestClassin interfaceTestExecutionListener- Overrides:
afterTestClassin classAbstractTestExecutionListener- Parameters:
testContext- the test context for the test; nevernull- Throws:
Exception- allows any exception to propagate
-