parent
e9c69aa46f
commit
133304c4f7
|
|
@ -139,6 +139,7 @@ import org.springframework.web.context.support.StandardServletEnvironment;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
|
* @author Christian Dupuis
|
||||||
* @see #run(Object, String[])
|
* @see #run(Object, String[])
|
||||||
* @see #run(Object[], String[])
|
* @see #run(Object[], String[])
|
||||||
* @see #SpringApplication(Object...)
|
* @see #SpringApplication(Object...)
|
||||||
|
|
@ -478,10 +479,11 @@ public class SpringApplication {
|
||||||
Resource resource = resourceLoader.getResource(location);
|
Resource resource = resourceLoader.getResource(location);
|
||||||
if (resource.exists()) {
|
if (resource.exists()) {
|
||||||
try {
|
try {
|
||||||
System.out.println(StreamUtils.copyToString(
|
String banner = StreamUtils.copyToString(
|
||||||
resource.getInputStream(),
|
resource.getInputStream(),
|
||||||
environment.getProperty("banner.charset", Charset.class,
|
environment.getProperty("banner.charset", Charset.class,
|
||||||
Charset.forName("UTF-8"))));
|
Charset.forName("UTF-8")));
|
||||||
|
System.out.println(environment.resolvePlaceholders(banner));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ import static org.mockito.Mockito.verify;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
|
* @author Christian Dupuis
|
||||||
*/
|
*/
|
||||||
public class SpringApplicationTests {
|
public class SpringApplicationTests {
|
||||||
|
|
||||||
|
|
@ -162,6 +163,15 @@ public class SpringApplicationTests {
|
||||||
verify(application, never()).printBanner();
|
verify(application, never()).printBanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void customBannerWithProperties() throws Exception {
|
||||||
|
SpringApplication application = spy(new SpringApplication(ExampleConfig.class));
|
||||||
|
application.setWebEnvironment(false);
|
||||||
|
application.run("--banner.location=classpath:test-banner-with-placeholder.txt",
|
||||||
|
"--test.property=123456");
|
||||||
|
verify(application, never()).printBanner();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customId() throws Exception {
|
public void customId() throws Exception {
|
||||||
SpringApplication application = new SpringApplication(ExampleConfig.class);
|
SpringApplication application = new SpringApplication(ExampleConfig.class);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
Running a Test!
|
||||||
|
|
||||||
|
${test.property}
|
||||||
Loading…
Reference in New Issue