Rework breaking API changes

This commit changes the new mode-based configuration to use two new
methods – setBannerMode on SpringApplication and bannerMode on
SpringApplicationBuilder. The old methods, setShowBanner and
showBanner on SpringApplication and SpringApplicationBuilder
respectively, have been reinstated and deprecated.

Closes gh-4001
This commit is contained in:
Andy Wilkinson
2015-10-08 10:44:16 +01:00
parent 3090659971
commit 01eb4cf954
8 changed files with 88 additions and 49 deletions

View File

@@ -43,6 +43,7 @@ content into your application; rather pick only the properties that you need.
spring.main.sources= # sources (class name, package name or XML resource location) to include
spring.main.web-environment= # detect by default
spring.main.show-banner=true
spring.main.banner-mode=console # the mode used to display the banner (console, off, or log)
spring.main....= # see class for all properties
# AUTO-CONFIGURATION

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=OFF
spring.main.banner_mode=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(Banner.Mode.OFF)
.bannerMode(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=CONSOLE
spring.main.banner_mode=console
----
The actual application will _now_ show the banner (as overridden by configuration) and use

View File

@@ -93,7 +93,7 @@ instance and customize it. For example, to turn off the banner you would write:
----
public static void main(String[] args) {
SpringApplication app = new SpringApplication(MySpringConfiguration.class);
app.setShowBanner(false);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
----
@@ -124,7 +124,7 @@ For example:
[source,java,indent=0]
----
new SpringApplicationBuilder()
.showBanner(Banner.Mode.OFF)
.bannerMode(Banner.Mode.OFF)
.sources(Parent.class)
.child(Application.class)
.run(args);