Overview
If AOT processing of a test's ApplicationContext
failed, we should immediately fail an attempt to load the corresponding context when running in AOT mode.
For example, if a test class uses Spring Boot's @MockBean
, AOT processing of that test's context will fail with a WARN
log message, and there will no mapping from that test class to an AOT-generated ApplicationContextInitializer
(ACI). Consequently, when the test suite is run in AOT mode that particular test class will fail with a confusing stack trace due to the fact that Spring Boot's SpringApplication
attempts to locate a "main" ACI instead of the missing "test" ACI.
The TestContext framework should therefore never attempt to load an ApplicationContext
in "JVM mode" while running in "AOT mode".
Deliverables
- [x] Rework the logic in
DefaultCacheAwareContextLoaderDelegate.loadContext(...)
to fail fast if an AOT-generated ACI cannot be found while running in AOT mode.