Relocate launcher classes
Create alternative launcher classes under the package `org.springframework.boot.loader.launch` and use them in favor of the previous location. This update is designed to improve compatibility with future changes in the loader. Closes gh-37667
This commit is contained in:
@@ -44,7 +44,7 @@ COPY --from=builder application/dependencies/ ./
|
||||
COPY --from=builder application/spring-boot-loader/ ./
|
||||
COPY --from=builder application/snapshot-dependencies/ ./
|
||||
COPY --from=builder application/application/ ./
|
||||
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
|
||||
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]
|
||||
----
|
||||
|
||||
Assuming the above `Dockerfile` is in the current directory, your docker image can be built with `docker build .`, or optionally specifying the path to your application jar, as shown in the following example:
|
||||
|
||||
@@ -28,8 +28,8 @@ The following shows an example of a `layers.idx` file:
|
||||
- BOOT-INF/lib/library1.jar
|
||||
- BOOT-INF/lib/library2.jar
|
||||
- "spring-boot-loader":
|
||||
- org/springframework/boot/loader/JarLauncher.class
|
||||
- org/springframework/boot/loader/jar/JarEntry.class
|
||||
- org/springframework/boot/loader/launch/JarLauncher.class
|
||||
- ... <other classes>
|
||||
- "snapshot-dependencies":
|
||||
- BOOT-INF/lib/library3-SNAPSHOT.jar
|
||||
- "application":
|
||||
|
||||
@@ -13,7 +13,7 @@ One way to run an unpacked archive is by starting the appropriate launcher, as f
|
||||
[source,shell,indent=0,subs="verbatim"]
|
||||
----
|
||||
$ jar -xf myapp.jar
|
||||
$ java org.springframework.boot.loader.JarLauncher
|
||||
$ java org.springframework.boot.loader.launch.JarLauncher
|
||||
----
|
||||
|
||||
This is actually slightly faster on startup (depending on the size of the jar) than running from an unexploded archive.
|
||||
|
||||
@@ -22,7 +22,7 @@ The following example shows a typical `MANIFEST.MF` for an executable jar file:
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
Main-Class: org.springframework.boot.loader.JarLauncher
|
||||
Main-Class: org.springframework.boot.loader.launch.JarLauncher
|
||||
Start-Class: com.mycompany.project.MyApplication
|
||||
----
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ The printed banner is registered as a singleton bean under the following name: `
|
||||
The `${application.version}` and `${application.formatted-version}` properties are only available if you are using Spring Boot launchers.
|
||||
The values will not be resolved if you are running an unpacked jar and starting it with `java -cp <classpath> <mainclass>`.
|
||||
|
||||
This is why we recommend that you always launch unpacked jars using `java org.springframework.boot.loader.JarLauncher`.
|
||||
This is why we recommend that you always launch unpacked jars using `java org.springframework.boot.loader.launch.JarLauncher`.
|
||||
This will initialize the `application.*` banner variables before building the classpath and launching your app.
|
||||
====
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ The following example shows how to build an executable archive with Ant:
|
||||
</mappedresources>
|
||||
<zipfileset src="${lib.dir}/loader/spring-boot-loader-jar-${spring-boot.version}.jar" />
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.springframework.boot.loader.JarLauncher" />
|
||||
<attribute name="Main-Class" value="org.springframework.boot.loader.launch.JarLauncher" />
|
||||
<attribute name="Start-Class" value="${start-class}" />
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
Reference in New Issue
Block a user