Browse Source

Update documentation for spring.main.sources

Closes gh-2851
pull/3050/head
Stephane Nicoll 11 years ago
parent
commit
51e6eda88a
  1. 2
      spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
  2. 24
      spring-boot-docs/src/main/asciidoc/howto.adoc
  3. 2
      spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json

2
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

@ -40,7 +40,7 @@ content into your application; rather pick only the properties that you need. @@ -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

24
spring-boot-docs/src/main/asciidoc/howto.adoc

@ -132,6 +132,30 @@ not be a web application. @@ -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

2
spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -89,7 +89,7 @@ @@ -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",

Loading…
Cancel
Save