From ad1ae8df91d84ac140744bd5591175088251bca9 Mon Sep 17 00:00:00 2001 From: Anand Shah Date: Fri, 11 Dec 2015 16:39:16 +0530 Subject: [PATCH 1/2] Add constants for banner location Closes gh-4665 --- .../org/springframework/boot/SpringApplication.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index f67c73fd9f..e0044af7d1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -145,6 +145,16 @@ import org.springframework.web.context.support.StandardServletEnvironment; */ public class SpringApplication { + /** + * The banner location property value used to load default banner. + */ + public static final String BANNER_LOCATION_PROPERTY_VALUE = "banner.txt"; + + /** + * The banner location property key. + */ + public static final String BANNER_LOCATION_PROPERTY = "banner.location"; + /** * The class name of application context that will be used by default for non-web * environments. @@ -536,7 +546,7 @@ public class SpringApplication { } private Banner selectBanner(Environment environment) { - String location = environment.getProperty("banner.location", "banner.txt"); + String location = environment.getProperty(BANNER_LOCATION_PROPERTY, BANNER_LOCATION_PROPERTY_VALUE); ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader : new DefaultResourceLoader(getClassLoader()); Resource resource = resourceLoader.getResource(location); From e9dfb2292eaf7cd8cac2a8992cc85fdc5df147ac Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 14 Dec 2015 18:13:24 +0100 Subject: [PATCH 2/2] Polish contribution Closes gh-4753 --- .../boot/SpringApplication.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index e0044af7d1..286518a64a 100644 --- a/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -145,16 +145,6 @@ import org.springframework.web.context.support.StandardServletEnvironment; */ public class SpringApplication { - /** - * The banner location property value used to load default banner. - */ - public static final String BANNER_LOCATION_PROPERTY_VALUE = "banner.txt"; - - /** - * The banner location property key. - */ - public static final String BANNER_LOCATION_PROPERTY = "banner.location"; - /** * The class name of application context that will be used by default for non-web * environments. @@ -172,6 +162,16 @@ public class SpringApplication { private static final String[] WEB_ENVIRONMENT_CLASSES = { "javax.servlet.Servlet", "org.springframework.web.context.ConfigurableWebApplicationContext" }; + /** + * Default banner location. + */ + public static final String BANNER_LOCATION_PROPERTY_VALUE = "banner.txt"; + + /** + * Banner location property key. + */ + public static final String BANNER_LOCATION_PROPERTY = "banner.location"; + private static final String CONFIGURABLE_WEB_ENVIRONMENT_CLASS = "org.springframework.web.context.ConfigurableWebEnvironment"; private static final String SYSTEM_PROPERTY_JAVA_AWT_HEADLESS = "java.awt.headless"; @@ -546,7 +546,8 @@ public class SpringApplication { } private Banner selectBanner(Environment environment) { - String location = environment.getProperty(BANNER_LOCATION_PROPERTY, BANNER_LOCATION_PROPERTY_VALUE); + String location = environment + .getProperty(BANNER_LOCATION_PROPERTY, BANNER_LOCATION_PROPERTY_VALUE); ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader : new DefaultResourceLoader(getClassLoader()); Resource resource = resourceLoader.getResource(location);