AOT 缓存
原文:https://docs.spring.io/spring-boot/how-to/aot-cache.html (Spring Boot 4.2.0)
本节包含关于在 Spring Boot 应用中使用 AOT 缓存的信息。有关 Spring Boot 对 AOT 缓存支持的概述,请参阅 AOT 缓存。
使用 AOT 缓存和 Buildpacks 打包应用
Spring Boot 对 Cloud Native Buildpacks 的支持以及 Paketo Java buildpack 及其 Spring Boot 支持可用于生成包含 AOT 缓存优化应用的 Docker 镜像。
要在生成的 Docker 镜像中启用 AOT 缓存,必须使用 Java 25 或更高版本,并且在构建镜像时应将 buildpack 环境变量 BP_JVM_AOTCACHE_ENABLED 设置为 true。这会导致 buildpack 对应用执行训练运行并生成 AOT 缓存文件,然后在运行时使用该文件。