Hello, i have created a very minimal& dummy app to narrow the issue down. so my pom.xml should have the minimal to test the aot executable and I tried some versions from 3 major, everything worked as expected and the executable would start the app very very fast. when i changed to 4.0.0-M1 (same for M3) i started getting an error when running the executable:

 :: Spring Boot ::             (v4.0.0-M1)

Application run failed
org.springframework.boot.AotInitializerNotFoundException: Startup with AOT mode enabled failed: AOT initializer com.baeldung.aot.Application__ApplicationContextInitializer could not be found
        at org.springframework.boot.SpringApplication.addAotGeneratedInitializerIfNecessary(SpringApplication.java:422)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:379)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1344)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1333)
        at com.baeldung.aot.Application.main(Application.java:16)
        at java.base@21.0.4/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

The pom doesn't contain anything really:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>4.0.0-M1</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

The main is the typical main. probably exactly what the initializer creates as default. it should be easily reproducable

Comment From: snicoll

Thanks for trying the milestones.

The main is the typical main. probably exactly what the initializer creates as default. it should be easily reproducable

As with any sample where the code is in text rather than with a reproducible example, things can be easily missed. Going forward please don't paste partial elements of the sample but rather a ZIP file that contains the project with instructions of how to reproduce.

You need GraalVM 25 with Spring Boot 4. I can only suspect you're using an older GraalVM version and the issue you've described would happen with the milestone.

I've tried with GraalVM 23.1.6-1

.   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::             (v4.0.0-M3)

Application run failed
org.springframework.boot.AotInitializerNotFoundException: Startup with AOT mode enabled failed: AOT initializer com.example.demo_native.DemoNativeApplication__ApplicationContextInitializer could not be found
        at org.springframework.boot.SpringApplication.addAotGeneratedInitializerIfNecessary(SpringApplication.java:428)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:384)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:319)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350)
        at com.example.demo_native.DemoNativeApplication.main(DemoNativeApplication.java:10)
        at java.base@21.0.6/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

Then I upgraded to RC1


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::            (v4.0.0-RC1)

Application run failed
org.springframework.boot.SpringApplication$NativeImageRequirementsNotMetException: Native Image requirements not met, please upgrade it. Native Image must support at least Java 25
        at org.springframework.boot.SpringApplication.checkNativeImageVersion(SpringApplication.java:446)
        at org.springframework.boot.SpringApplication.addAotGeneratedInitializerIfNecessary(SpringApplication.java:423)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:385)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1374)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
        at com.example.demo_native.DemoNativeApplication.main(DemoNativeApplication.java:10)
        at java.base@21.0.6/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

So TL;DR is that RC1 is out, See also #47433 that provides an improved error message to guide users.