parent
a62ec1028c
commit
68af0a73ec
|
|
@ -50,10 +50,10 @@ rules of thumb:
|
|||
properties, thus `ServerProperties` has `prefix="server"` and its configuration properties
|
||||
are `server.port`, `server.address` etc. In a running Actuator app look at the
|
||||
`configprops` endpoint.
|
||||
* Look for use of `RelaxedEnvironment` to pull configuration values explicitly out of the
|
||||
* Look for use of `RelaxedPropertyResolver` to pull configuration values explicitly out of the
|
||||
`Environment`. It often is used with a prefix.
|
||||
* Look for `@Value` annotations that bind directly to the `Environment`. This is less
|
||||
flexible than the `RelaxedEnvironment` approach, but does allow some relaxed binding,
|
||||
flexible than the `RelaxedPropertyResolver` approach, but does allow some relaxed binding,
|
||||
specifically for OS environment variables (so `CAPITALS_AND_UNDERSCORES` are synonyms
|
||||
for `period.separated`).
|
||||
* Look for `@ConditionalOnExpression` annotations that switch features on and off in
|
||||
|
|
@ -169,8 +169,8 @@ application sources. Classes passed to the `SpringApplication` static convenienc
|
|||
methods, and those added using `setSources()` are inspected to see if they have
|
||||
`@PropertySources`, and if they do, those properties are added to the `Environment` early
|
||||
enough to be used in all phases of the `ApplicationContext` lifecycle. Properties added
|
||||
in this way have precedence over any added using the default locations, but have lower
|
||||
priority than system properties, environment variables or the command line.
|
||||
in this way have lower
|
||||
priority than any added using the default locations (e.g. `application.properties), system properties, environment variables or the command line.
|
||||
|
||||
You can also provide System properties (or environment variables) to change the behavior:
|
||||
|
||||
|
|
@ -339,7 +339,7 @@ The appendix includes an <<appendix-application-properties#common-application-pr
|
|||
`application.properties`>> example with a list of the most common properties supported by
|
||||
Spring Boot. The definitive list comes from searching the source code for
|
||||
`@ConfigurationProperties` and `@Value` annotations, as well as the occasional use of
|
||||
`RelaxedEnvironment`.
|
||||
`RelaxedPropertyResolver`.
|
||||
|
||||
|
||||
|
||||
|
|
@ -1175,8 +1175,9 @@ using the "logging.config" property.
|
|||
|
||||
[[howto-configure-logback-for-loggin]]
|
||||
=== Configure Logback for logging
|
||||
If you put a `logback-spring.xml` in the root of your classpath it will be picked up from
|
||||
there. Spring Boot provides a default base configuration that you can include if you just
|
||||
If you put a `logback.xml` in the root of your classpath it will be picked up from
|
||||
there
|
||||
(or `logback-spring.xml` to take advantage of the templating features provided by Boot). Spring Boot provides a default base configuration that you can include if you just
|
||||
want to set levels, e.g.
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
|
||||
|
|
@ -1188,7 +1189,7 @@ want to set levels, e.g.
|
|||
</configuration>
|
||||
----
|
||||
|
||||
If you look at the default `logback.xml` in the spring-boot jar you will see that it uses
|
||||
If you look at that `base.xml` in the spring-boot jar, you will see that it uses
|
||||
some useful System properties which the `LoggingSystem` takes care of creating for you.
|
||||
These are:
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ You can use the following variables inside your `banner.txt` file:
|
|||
| Variable | Description
|
||||
|
||||
|`${application.version}`
|
||||
|The version number of your application as declared in `MANIFEST.MF`. For example `1.0`.
|
||||
|The version number of your application as declared in `MANIFEST.MF`. For example `Implementation-Version: 1.0` is printed as `1.0`.
|
||||
|
||||
|`${application.formatted-version}`
|
||||
|The version number of your application as declared in `MANIFEST.MF` formatted for
|
||||
|
|
|
|||
|
|
@ -512,6 +512,8 @@ public class ConfigFileApplicationListenerTests {
|
|||
ConfigurableApplicationContext context = application.run();
|
||||
String property = context.getEnvironment().getProperty("the.property");
|
||||
assertThat(property, equalTo("fromspecificlocation"));
|
||||
property = context.getEnvironment().getProperty("my.property");
|
||||
assertThat(property, equalTo("fromapplicationproperties"));
|
||||
assertThat(context.getEnvironment(),
|
||||
containsPropertySource("class path resource "
|
||||
+ "[specificlocation.properties]"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue