Load ApplicationContextFailureProcessors from spring.factories

At the request of the Spring Boot team, ApplicationContextFailureProcessor
implementations are now loaded via the spring.factories mechanism
instead of supporting a single processor registered via subclasses of
AbstractTestContextBootstrapper.

This makes the retrieval and handling of processors internal to
DefaultCacheAwareContextLoaderDelegate, while simultaneously supporting
multiple processors that can be registered by anyone (i.e., not
limited to projects that implement custom TestContextBootstrappers).

See gh-28826
Closes gh-29387
This commit is contained in:
Sam Brannen
2022-10-26 19:00:27 +02:00
parent 273e38c2b4
commit a13cb01b99
6 changed files with 141 additions and 75 deletions

View File

@@ -1,6 +1,10 @@
# Test configuration file containing a non-existent default TestExecutionListener and a demo ContextCustomizerFactory.
# Test configuration file containing a non-existent default TestExecutionListener,
# a demo ContextCustomizerFactory, and a demo ApplicationContextFailureProcessor.
org.springframework.test.context.TestExecutionListener = org.example.FooListener
org.springframework.test.context.ContextCustomizerFactory =\
org.springframework.test.context.aot.samples.basic.ImportsContextCustomizerFactory
org.springframework.test.context.ApplicationContextFailureProcessor =\
org.springframework.test.context.failures.TrackingApplicationContextFailureProcessor