diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/class-data-sharing.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/class-data-sharing.adoc index 288a60b50026..33fb6cf9d104 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/class-data-sharing.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/class-data-sharing.adoc @@ -38,12 +38,18 @@ To use the AOT cache, you should first perform a training run on your applicatio ---- $ java -Djarmode=tools -jar my-app.jar extract --destination application $ cd application +---- + +=== Java 24 + +[source,shell] +---- $ java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconf -Dspring.context.exit=onRefresh -jar my-app.jar $ java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot -jar my-app.jar ---- This creates an `app.aot` cache file that can be reused as long as the application is not updated. -The intermediate `app.aotconf` file is no longer needed and can be safely deleted. +The intermediate `app.aotconf` file is required in Java 24. To use the cache file, you need to add an extra parameter when starting the application: @@ -51,3 +57,15 @@ To use the cache file, you need to add an extra parameter when starting the appl ---- $ java -XX:AOTCache=app.aot -jar my-app.jar ---- + +=== Java 25 and later + +[source,shell] +---- +$ java -Djarmode=tools -jar my-app.jar extract --destination application +$ cd application +$ java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar my-app.jar +$ java -XX:AOTCache=app.aot -jar my-app.jar +---- +Here the intermediate `app.aotconf` file is no longer needed and can be safely deleted. + diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/container-images/dockerfiles.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/container-images/dockerfiles.adoc index 0e43466a1714..b8d611939982 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/container-images/dockerfiles.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/container-images/dockerfiles.adoc @@ -85,6 +85,7 @@ include::reference:partial$dockerfile[] # Execute the AOT cache training run RUN java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconf -Dspring.context.exit=onRefresh -jar application.jar RUN java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot -jar application.jar && rm app.aotconf + # 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