From 33c038199d6bddc745da22ec56ae48a0c59e3e1c Mon Sep 17 00:00:00 2001 From: Robert Smith <58187843+robert-smith-911@users.noreply.github.com> Date: Sat, 23 Jan 2021 21:21:33 -0500 Subject: [PATCH 1/2] Add note about exploded jars and banner properties Add a note to the "Customizing the Banner" explaining that you need to be using the `JarLauncher` to use the `application.*` properties. See gh-24982 --- .../src/docs/asciidoc/spring-boot-features.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index 7bf96c99eedb..2d1a0588f8c4 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -150,6 +150,9 @@ You can also use the configprop:spring.main.banner-mode[] property to determine The printed banner is registered as a singleton bean under the following name: `springBootBanner`. +NOTE: If you are running with an unpacked jar (and not using the Spring Boot launcher), `application.*` properties are not available. +As a workaround, you can use JarLauncher to start the app (for example, `java -cp . org.springframework.boot.loader.JarLauncher`). + [[boot-features-customizing-spring-application]] From 5b2d1f19a0018418ee1466a45e25ab93d9434211 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 28 Jan 2021 18:38:24 -0800 Subject: [PATCH 2/2] Polish 'Add note about exploded jars and banner properties' See gh-24982 --- .../src/docs/asciidoc/spring-boot-features.adoc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index 2d1a0588f8c4..a9799d23009f 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -150,8 +150,14 @@ You can also use the configprop:spring.main.banner-mode[] property to determine The printed banner is registered as a singleton bean under the following name: `springBootBanner`. -NOTE: If you are running with an unpacked jar (and not using the Spring Boot launcher), `application.*` properties are not available. -As a workaround, you can use JarLauncher to start the app (for example, `java -cp . org.springframework.boot.loader.JarLauncher`). +[NOTE] +==== +The `${application.version}` and `${application.formatted-version}` properties are only available if you are using Spring Boot launchers. +The values won't be resolved if you are running an unpacked jar and starting it with `java -cp `. + +This is why we recommend that you always use launch unpacked jars using `java org.springframework.boot.loader.JarLauncher`. +This will initialize the `application.*` banner variables before building the classpath and launching your app. +====