diff --git a/spring-boot-samples/spring-boot-sample-xml/src/main/java/org/springframework/boot/sample/xml/SampleSpringXmlApplication.java b/spring-boot-samples/spring-boot-sample-xml/src/main/java/org/springframework/boot/sample/xml/SampleSpringXmlApplication.java
index cc27827d71..6f2f5ec246 100644
--- a/spring-boot-samples/spring-boot-sample-xml/src/main/java/org/springframework/boot/sample/xml/SampleSpringXmlApplication.java
+++ b/spring-boot-samples/spring-boot-sample-xml/src/main/java/org/springframework/boot/sample/xml/SampleSpringXmlApplication.java
@@ -32,7 +32,6 @@ public class SampleSpringXmlApplication implements CommandLineRunner {
}
public static void main(String[] args) throws Exception {
- // TODO: to make this a pure XML example, will need
SpringApplication.run("classpath:/META-INF/application-context.xml", args);
}
}
diff --git a/spring-boot/src/main/java/org/springframework/boot/config/PropertiesPropertySourceLoader.java b/spring-boot/src/main/java/org/springframework/boot/config/PropertiesPropertySourceLoader.java
index 42bb301769..8022374160 100644
--- a/spring-boot/src/main/java/org/springframework/boot/config/PropertiesPropertySourceLoader.java
+++ b/spring-boot/src/main/java/org/springframework/boot/config/PropertiesPropertySourceLoader.java
@@ -19,6 +19,8 @@ package org.springframework.boot.config;
import java.io.IOException;
import java.util.Properties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.Resource;
@@ -31,6 +33,8 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
*/
public class PropertiesPropertySourceLoader implements PropertySourceLoader {
+ private static Log logger = LogFactory.getLog(PropertiesPropertySourceLoader.class);
+
@Override
public boolean supports(Resource resource) {
return resource.getFilename().endsWith(".properties");
@@ -40,6 +44,11 @@ public class PropertiesPropertySourceLoader implements PropertySourceLoader {
public PropertySource> load(Resource resource) {
try {
Properties properties = loadProperties(resource);
+ // N.B. this is off by default unless user has supplied logback config in
+ // standard location
+ if (logger.isDebugEnabled()) {
+ logger.debug("Properties loaded from " + resource + ": " + properties);
+ }
return new PropertiesPropertySource(resource.getDescription(), properties);
}
catch (IOException ex) {
diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
index d45448fcc9..5d402b261e 100644
--- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
+++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
@@ -59,7 +59,8 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem {
}
public LogbackLoggingSystem(ClassLoader classLoader) {
- super(classLoader, "logback.xml");
+ super(classLoader, "logback-test.groovy", "logback-test.xml", "logback.groovy",
+ "logback.xml");
}
@Override
diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
index e4b9e5f4e1..99a0fd91f2 100644
--- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
@@ -273,6 +273,16 @@ public class SpringApplicationTests {
assertEquals("bar", environment.getProperty("foo"));
}
+ @Test
+ public void proprtiesFileEnhancesEnvironment() throws Exception {
+ SpringApplication application = new SpringApplication(ExampleConfig.class);
+ application.setWebEnvironment(false);
+ ConfigurableEnvironment environment = new StandardEnvironment();
+ application.setEnvironment(environment);
+ application.run();
+ assertEquals("bucket", environment.getProperty("foo"));
+ }
+
@Test
public void emptyCommandLinePropertySourceNotAdded() throws Exception {
SpringApplication application = new SpringApplication(ExampleConfig.class);
@@ -404,8 +414,6 @@ public class SpringApplicationTests {
// FIXME test initializers
- // FIXME test config files?
-
public static class SpyApplicationContext extends AnnotationConfigApplicationContext {
ConfigurableApplicationContext applicationContext = spy(new AnnotationConfigApplicationContext());
diff --git a/spring-boot/src/test/java/org/springframework/boot/context/initializer/LoggingApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/initializer/LoggingApplicationContextInitializerTests.java
index 9b0c049567..5685c902fa 100644
--- a/spring-boot/src/test/java/org/springframework/boot/context/initializer/LoggingApplicationContextInitializerTests.java
+++ b/spring-boot/src/test/java/org/springframework/boot/context/initializer/LoggingApplicationContextInitializerTests.java
@@ -153,7 +153,7 @@ public class LoggingApplicationContextInitializerTests {
@Test
public void parseArgsDisabled() throws Exception {
this.initializer.setParseArgs(false);
- this.initializer.initialize(this.springApplication, new String[] { "--debug" });
+ TestUtils.addEnviroment(this.context, "debug");
this.initializer.initialize(this.context);
this.logger.debug("testatdebug");
assertThat(this.outputCapture.toString(), not(containsString("testatdebug")));
diff --git a/spring-boot/src/test/resources/logback-test.xml b/spring-boot/src/test/resources/logback-test.xml
index 85ea91eb53..82af2606c9 100644
--- a/spring-boot/src/test/resources/logback-test.xml
+++ b/spring-boot/src/test/resources/logback-test.xml
@@ -1,14 +1,11 @@
-
${LOG_PATTERN}
-
-