Merge branch '4.0.x'

This commit is contained in:
Phillip Webb
2026-05-22 14:43:59 -07:00
@@ -54,33 +54,10 @@ Additionally, the layout created by the `jarmode` is AOT cache (and CDS) friendl
[[packaging.container-images.dockerfiles.aot-cache]]
== AOT Cache
NOTE: If you're using Java < 24, AOT cache is not available.
You have to use CDS instead.
If you want to additionally enable the xref:reference:packaging/aot-cache.adoc#packaging.aot-cache.aot-cache[AOT cache], you can use this `Dockerfile`:
[source,dockerfile]
----
include::reference:partial$dockerfile[]
# Execute the AOT cache training run
RUN java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar application.jar
# Start the application jar with AOT cache enabled - this is not the uber jar used by the builder
# This jar only contains application code and references to the extracted jar files
# This layout is efficient to start up and AOT cache friendly
ENTRYPOINT ["java", "-XX:AOTCache=app.aot", "-jar", "application.jar"]
----
This is mostly the same as the above `Dockerfile`.
As the last steps, it creates the AOT cache file by doing a training run and passes the AOT cache parameter to `java -jar`.
[[packaging.container-images.dockerfiles.aot-cache]]
== AOT cache
If you are using Java 25 or above, and want to additionally enable the xref:reference:packaging/class-data-sharing.adoc#packaging.class-data-sharing.aot-cache[AOT cache], you can use this `Dockerfile`:
If you are using Java 25 or above, and want to additionally enable the xref:reference:packaging/aot-cache.adoc#packaging.aot-cache.aot-cache[AOT cache], you can use this `Dockerfile`:
[source,dockerfile]
----
include::reference:partial$dockerfile[]