sdeleuze/spring-jvm-aot:在 Buildpacks 创建的容器上启用 AOT 处理的示例项目


这个存储库展示了如何使用Spring AOT 优化来加速廉价云实例的启动。

请注意,AOT 优化会在构建时修复在应用程序上下文中创建的 bean,目前不支持在运行时更改 Spring 配置文件,请参阅spring-framework#29844相关问题。

将以下配置文件添加到您的pom.xml:

<profiles>
    <profile>
        <id>aot</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>process-aot</id>
                            <goals>
                                <goal>process-aot</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <image>
                            <env>
                                <BPE_DELIM_JAVA_TOOL_OPTIONS xml:space="preserve"> </BPE_DELIM_JAVA_TOOL_OPTIONS>
                                <BPE_APPEND_JAVA_TOOL_OPTIONS>-Dspring.aot.enabled=true</BPE_APPEND_JAVA_TOOL_OPTIONS>
                            </env>
                        </image>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

使用:
mvn -Paot spring-boot:build-image

请参阅项目中demo-maven-aot相关示例。

详细点击标题