Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,34 @@ 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:

[source,shell]
----
$ 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.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down