Closed
Description
I guess technically @DisabledInNativeImage
doesn't mean "disable AOT processing", but if the annotation is there, it's probably a sign that we don't expect AOT to work? So the stack traces (logged at WARN level) seem harsh, and hard to debug (there's no hint as to why it's there). Arguably it shouldn't even be a warning. To reproduce just add a @MockBean
and @DisabledInNativeImage
to a test and and try to run native tests. The test doesn't run but the exception is logged in the build.
Example from PetClinic:
2023-07-07T10:35:23.700+01:00 WARN 3778203 --- [ main] o.s.t.c.aot.TestContextAotGenerator : Failed to generate AOT artifacts for test classes [org.springframework.samples.petclinic.vet.VetControllerTests]
org.springframework.test.context.aot.TestContextAotException: Failed to process test class [org.springframework.samples.petclinic.vet.VetControllerTests] for AOT
at org.springframework.test.context.aot.TestContextAotGenerator.processAheadOfTime(TestContextAotGenerator.java:239) ~[spring-test-6.0.10.jar:6.0.10]
at org.springframework.test.context.aot.TestContextAotGenerator.lambda$processAheadOfTime$4(TestContextAotGenerator.java:205) ~[spring-test-6.0.10.jar:6.0.10]
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[na:na]
at org.springframework.util.MultiValueMapAdapter.forEach(MultiValueMapAdapter.java:179) ~[spring-core-6.0.10.jar:6.0.10]
at org.springframework.test.context.aot.TestContextAotGenerator.processAheadOfTime(TestContextAotGenerator.java:197) ~[spring-test-6.0.10.jar:6.0.10]
...