Commit 51e6eda8 authored by Stephane Nicoll's avatar Stephane Nicoll

Update documentation for spring.main.sources

Closes gh-2851
parent 97cf8680
......@@ -40,7 +40,7 @@ content into your application; rather pick only the properties that you need.
spring.profiles.include= # unconditionally activate the specified comma separated profiles
# APPLICATION SETTINGS ({sc-spring-boot}/SpringApplication.{sc-ext}[SpringApplication])
spring.main.sources=
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....= # see class for all properties
......
......@@ -132,6 +132,30 @@ not be a web application.
NOTE: The example above also demonstrates how flexible binding allows the use of
underscores (`_`) as well as dashes (`-`) in property names.
Properties defined in external configuration overrides the values specified via the Java
API with the notable exception of the sources used to create the `ApplicationContext`. Let's
consider this application
[source,java,indent=0]
----
new SpringApplicationBuilder()
.showBanner(false)
.sources(demo.MyApp.class)
.run(args);
----
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
----
The actual application will _not_ show the banner and use three sources for the
`ApplicationContext` (in that order): `demo.MyApp`, `com.acme.Config`,
`com.acme.ExtraConfig`.
[[howto-change-the-location-of-external-properties]]
=== Change the location of external properties of an application
By default properties from different sources are added to the Spring `Environment` in a
......
......@@ -89,7 +89,7 @@
"name": "spring.main.sources",
"type": "java.util.Set<java.lang.Object>",
"sourceType": "org.springframework.boot.SpringApplication",
"description": "Sources (class name, package name or XML resource location) used to create the ApplicationContext."
"description": "Sources (class name, package name or XML resource location) to include in the ApplicationContext."
},
{
"name": "spring.main.web-environment",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment