Forbid loading of a test's ApplicationContext
in AOT mode if AOT processing failed
#29579
Closed
1 task done
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Milestone
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 aWARN
log message, and there will no mapping from that test class to an AOT-generatedApplicationContextInitializer
(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'sSpringApplication
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
DefaultCacheAwareContextLoaderDelegate.loadContext(...)
to fail fast if an AOT-generated ACI cannot be found while running in AOT mode.The text was updated successfully, but these errors were encountered: