Add logging at INFO level if AOT is enabled and working
Currently there is no visual clue that it is working, so you don't know if you set the property right or not.
I realize this issue is about the main application, but it's worth pointing out that the TestContext framework already logs an INFO message for the org.springframework.test.context.cache log category each time an AOT-optimized ApplicationContext is loaded.
In tests you'll see something like the following.
15:25:13.111 [main] INFO o.s.t.c.c.DefaultCacheAwareContextLoaderDelegate - Loading ApplicationContext in AOT mode for [MergedContextConfiguration@656ec00d testClass = BasicSpringJupiterSharedConfigTests, locations = '{}', classes = '{class org.springframework.test.context.aot.samples.basic.BasicTestConfiguration}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{test.engine = jupiter}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]
AotApplicationContextInitializer logs a DEBUG message here:
https://github.com/spring-projects/spring-boot/blob/2b503ee334da9c196fe7023bd1ff2b8c2ecd392f/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/AotApplicationContextInitializer.java#L45
Do you see that if you set the log level to DEBUG for org.springframework.boot?
Applications running in AOT mode now log something like this:
Starting AOT-processed SampleSimpleApplication using Java 17.0.4.1 on fedora with PID 267858
while non-AOT applications log this:
Starting SampleSimpleApplication using Java 17.0.4.1 on fedora with PID 267858