Running Spring Boot application with AOT optimizations is broken due to https://github.com/spring-projects/spring-boot/commit/7a5b61fd19e0757d8bf28a3a1a4ef6accfd38261. Here's an example

2022-09-30T10:25:01.712+02:00 DEBUG 88784 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : Application failed to start due to an exception

java.lang.NoSuchMethodError: 'org.springframework.context.ApplicationContextInitializer org.springframework.context.aot.AotApplicationContextInitializer.forInitializerClasses(java.lang.String[])'
    at org.springframework.boot.SpringApplication.addAotGeneratedInitializerIfNecessary(SpringApplication.java:423) ~[spring-boot-3.0.0-SNAPSHOT.jar!/:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:384) ~[spring-boot-3.0.0-SNAPSHOT.jar!/:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) ~[spring-boot-3.0.0-SNAPSHOT.jar!/:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1315) ~[spring-boot-3.0.0-SNAPSHOT.jar!/:3.0.0-SNAPSHOT]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.0-SNAPSHOT.jar!/:3.0.0-SNAPSHOT]
    at com.example.commandlinerunner.CommandlinerunnerApplication.main(CommandlinerunnerApplication.java:10) ~[classes!/:na]

Our build is green so some tests are definitely missing.

Comment From: philwebb

I've added a test but I can't replicate the NoSuchMethodError when reverting f0e40bb00dd71bc7cfa4cec8d808ef7afc277871. I'll do a full build then run the samples to see if it still happens.

I can't help thinking that there was somehow a stale Framework jar that didn't have this fix in it.