Add an option to log banner rather than printing it to standard out

This commit adds the option to output the banner using the logger
instead of standard out. Rather than taking a boolean
spring.main.show-banner is now configured using an enum. Three values
are supported:

 - LOG: the banner is logged
 - CONSOLE: the banner is printed to standard out (previously true)
 - OFF: the banner is switched off (previously false)

The default behavior remains unchanged; the banner will be printed to
standard out.

Closes gh-4022
See gh-4001
This commit is contained in:
“Jeremy
2015-09-24 11:42:04 -06:00
committed by Andy Wilkinson
parent 031a8d5afa
commit 3090659971
10 changed files with 101 additions and 37 deletions

View File

@@ -123,7 +123,7 @@ might have.
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
----
spring.main.web_environment=false
spring.main.show_banner=false
spring.main.show_banner=OFF
----
and then the Spring Boot banner will not be printed on startup, and the application will
@@ -139,7 +139,7 @@ consider this application
[source,java,indent=0]
----
new SpringApplicationBuilder()
.showBanner(false)
.showBanner(Banner.Mode.OFF)
.sources(demo.MyApp.class)
.run(args);
----
@@ -149,7 +149,7 @@ used with the following configuration:
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
----
spring.main.sources=com.acme.Config,com.acme.ExtraConfig
spring.main.show-banner=true
spring.main.show-banner=CONSOLE
----
The actual application will _now_ show the banner (as overridden by configuration) and use

View File

@@ -124,7 +124,7 @@ For example:
[source,java,indent=0]
----
new SpringApplicationBuilder()
.showBanner(false)
.showBanner(Banner.Mode.OFF)
.sources(Parent.class)
.child(Application.class)
.run(args);