Merge pull request #4709 from izeye/polish-20151209
* pr/4709: Polish contribution Polish docs
This commit is contained in:
commit
a6409edab0
|
@ -475,13 +475,13 @@ defined using the naming convention `application-{profile}.properties`. The
|
||||||
used if no active profiles are set (i.e. if no profiles are explicitly activated
|
used if no active profiles are set (i.e. if no profiles are explicitly activated
|
||||||
then properties from `application-default.properties` are loaded).
|
then properties from `application-default.properties` are loaded).
|
||||||
|
|
||||||
Profile specific properties are loaded from the same locations as standard
|
Profile-specific properties are loaded from the same locations as standard
|
||||||
`application.properties`, with profile-specific files always overriding the non-specific
|
`application.properties`, with profile-specific files always overriding the non-specific
|
||||||
ones irrespective of whether the profile-specific files are inside or outside your
|
ones irrespective of whether the profile-specific files are inside or outside your
|
||||||
packaged jar.
|
packaged jar.
|
||||||
|
|
||||||
If several profiles are specified, a last wins strategy applies. For example, profiles
|
If several profiles are specified, a last wins strategy applies. For example, profiles
|
||||||
specified by the `spring.active.profiles` property are added after those configured via
|
specified by the `spring.profiles.active` property are added after those configured via
|
||||||
the `SpringApplication` API and therefore take precedence.
|
the `SpringApplication` API and therefore take precedence.
|
||||||
|
|
||||||
|
|
||||||
|
@ -930,7 +930,7 @@ properties, the highest `PropertySource` will win. This means that you can speci
|
||||||
active profiles in `application.properties` then *replace* them using the command line
|
active profiles in `application.properties` then *replace* them using the command line
|
||||||
switch.
|
switch.
|
||||||
|
|
||||||
Sometimes it is useful to have profile specific properties that *add* to the active
|
Sometimes it is useful to have profile-specific properties that *add* to the active
|
||||||
profiles rather than replace them. The `spring.profiles.include` property can be used
|
profiles rather than replace them. The `spring.profiles.include` property can be used
|
||||||
to unconditionally add active profiles. The `SpringApplication` entry point also has
|
to unconditionally add active profiles. The `SpringApplication` entry point also has
|
||||||
a Java API for setting additional profiles (i.e. on top of those activated by the
|
a Java API for setting additional profiles (i.e. on top of those activated by the
|
||||||
|
@ -963,8 +963,8 @@ possible to activate profiles using Spring's `ConfigurableEnvironment` interface
|
||||||
|
|
||||||
|
|
||||||
[[boot-features-profile-specific-configuration]]
|
[[boot-features-profile-specific-configuration]]
|
||||||
=== Profile specific configuration files
|
=== Profile-specific configuration files
|
||||||
Profile specific variants of both `application.properties` (or `application.yml`) and
|
Profile-specific variants of both `application.properties` (or `application.yml`) and
|
||||||
files referenced via `@ConfigurationProperties` are considered as files are loaded.
|
files referenced via `@ConfigurationProperties` are considered as files are loaded.
|
||||||
See _<<boot-features-external-config-profile-specific-properties>>_ for details.
|
See _<<boot-features-external-config-profile-specific-properties>>_ for details.
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ converter will color the output according to the log level, for example:
|
||||||
|
|
||||||
[source,indent=0]
|
[source,indent=0]
|
||||||
----
|
----
|
||||||
%clr(-%5p})
|
%clr(-%5p)
|
||||||
----
|
----
|
||||||
|
|
||||||
The mapping of log level to a color is as follows:
|
The mapping of log level to a color is as follows:
|
||||||
|
@ -1259,7 +1259,7 @@ it's loaded too early. You need to either use `logback-spring.xml` or define a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
==== Profile specific configuration
|
==== Profile-specific configuration
|
||||||
The `<springProfile>` tag allows you to optionally include or exclude sections of
|
The `<springProfile>` tag allows you to optionally include or exclude sections of
|
||||||
configuration based on the active Spring profiles. Profile sections are supported anywhere
|
configuration based on the active Spring profiles. Profile sections are supported anywhere
|
||||||
within the `<configuration>` element. Use the `name` attribute to specify which profile
|
within the `<configuration>` element. Use the `name` attribute to specify which profile
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
|
||||||
// Search for a file with the given name
|
// Search for a file with the given name
|
||||||
for (String ext : this.propertiesLoader.getAllFileExtensions()) {
|
for (String ext : this.propertiesLoader.getAllFileExtensions()) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
// Try the profile specific file
|
// Try the profile-specific file
|
||||||
loadIntoGroup(group, location + name + "-" + profile + "." + ext,
|
loadIntoGroup(group, location + name + "-" + profile + "." + ext,
|
||||||
null);
|
null);
|
||||||
for (String processedProfile : this.processedProfiles) {
|
for (String processedProfile : this.processedProfiles) {
|
||||||
|
@ -440,7 +440,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor,
|
||||||
loadIntoGroup(group, location + name + "-" + profile + "." + ext,
|
loadIntoGroup(group, location + name + "-" + profile + "." + ext,
|
||||||
profile);
|
profile);
|
||||||
}
|
}
|
||||||
// Also try the profile specific section (if any) of the normal file
|
// Also try the profile-specific section (if any) of the normal file
|
||||||
loadIntoGroup(group, location + name + "." + ext, profile);
|
loadIntoGroup(group, location + name + "." + ext, profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class ConfigFileApplicationListenerTests {
|
||||||
assertEquals("myprofile", StringUtils
|
assertEquals("myprofile", StringUtils
|
||||||
.arrayToCommaDelimitedString(this.environment.getActiveProfiles()));
|
.arrayToCommaDelimitedString(this.environment.getActiveProfiles()));
|
||||||
String property = this.environment.getProperty("the.property");
|
String property = this.environment.getProperty("the.property");
|
||||||
// The value from the second file wins (no profile specific configuration is
|
// The value from the second file wins (no profile-specific configuration is
|
||||||
// actually loaded)
|
// actually loaded)
|
||||||
assertThat(property, equalTo("frompropertiesfile"));
|
assertThat(property, equalTo("frompropertiesfile"));
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ public class ConfigFileApplicationListenerTests {
|
||||||
assertEquals("myprofile", StringUtils
|
assertEquals("myprofile", StringUtils
|
||||||
.arrayToCommaDelimitedString(this.environment.getActiveProfiles()));
|
.arrayToCommaDelimitedString(this.environment.getActiveProfiles()));
|
||||||
String property = this.environment.getProperty("the.property");
|
String property = this.environment.getProperty("the.property");
|
||||||
// The value from the second file wins (no profile specific configuration is
|
// The value from the second file wins (no profile-specific configuration is
|
||||||
// actually loaded)
|
// actually loaded)
|
||||||
assertThat(property, equalTo("frompropertiesfile"));
|
assertThat(property, equalTo("frompropertiesfile"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue