Fix CDS link and clarify where and when to run the commands

Closes gh-41321
This commit is contained in:
Moritz Halbritter 2024-07-04 16:01:37 +02:00
parent 8000754f73
commit 2a20ceb3fd
1 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,7 @@
[[packaging.efficient.unpacking]] [[packaging.efficient.unpacking]]
== Unpacking the Executable JAR == Unpacking the Executable jar
You can run your application using the executable jar, but loading the classes from nested jars has a small startup cost. You can run your application using the executable jar, but loading the classes from nested jars has a small startup cost.
Depending on the size of the jar, running the application from an exploded structure is faster and recommended in production. Depending on the size of the jar, running the application from an exploded structure is faster and recommended in production.
@ -12,14 +12,22 @@ Certain PaaS implementations may also choose to extract archives before they run
For example, Cloud Foundry operates this way. For example, Cloud Foundry operates this way.
Spring Boot supports extracting your application to a directory using different layouts. Spring Boot supports extracting your application to a directory using different layouts.
The default layout is the most efficient, and is xref:#deployment.efficient.cds[CDS friendly]. The default layout is the most efficient, and is xref:reference:packaging/class-data-sharing.adoc[CDS friendly].
In this layout, the libraries are extracted to a `lib/` folder, and the application JAR In this layout, the libraries are extracted to a `lib/` folder, and the application jar
contains the application classes and a manifest which references the libraries in the `lib/` folder. contains the application classes and a manifest which references the libraries in the `lib/` folder.
To unpack the executable jar, run this command:
[source,shell] [source,shell]
---- ----
$ java -Djarmode=tools -jar my-app.jar extract $ java -Djarmode=tools -jar my-app.jar extract
----
And then in production, you can run the extracted jar:
[source,shell]
----
$ java -jar my-app/my-app.jar $ java -jar my-app/my-app.jar
---- ----