Introduce AotContextLoader SPI in the TestContext framework

This commit introduces a dedicated AotContextLoader extension of
SmartContextLoader and reverts the recent changes to the existing
contract for SmartContextLoader. This allows existing
SmartContextLoader implementations to continue working unaffected by
AOT support unless they opt into AOT support by explicitly implementing
the new AotContextLoader contract.

In addition, existing SmartContextLoader implementations in the
spring-test module have been modified to implement AotContextLoader
instead of SmartContextLoader. This allows the core framework to
provide built-in AOT support in the TestContext framework, and it also
allows third-party extensions to built-in SmartContextLoaders to
participate in AOT processing and run-time support transparently (or at
least as transparent as possible).

Closes gh-28906
This commit is contained in:
Sam Brannen
2022-08-18 17:41:43 +02:00
parent c1a6bfc701
commit 84c377965c
7 changed files with 216 additions and 67 deletions

View File

@@ -110,7 +110,7 @@ class DelegatingSmartContextLoaderTests {
assertThatIllegalStateException()
.isThrownBy(() -> loader.loadContext(mergedConfig))
.withMessageStartingWith("Neither")
.withMessageContaining("was able to load an ApplicationContext from");
.withMessageContaining("is able to load an ApplicationContext for");
}
/**