Skip to content

AOT executable issue after upgrading to 4.0.0-M1/M2/M3 #47800

@bpstelios10

Description

@bpstelios10

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions