Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
4e8592ff
Commit
4e8592ff
authored
Jul 14, 2017
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update documentation with new relaxed rules
Closes gh-9025
parent
e844c924
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+4
-7
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+29
-5
No files found.
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
4e8592ff
...
@@ -74,12 +74,9 @@ rules of thumb:
...
@@ -74,12 +74,9 @@ rules of thumb:
properties, thus `ServerProperties` has `prefix="server"` and its configuration properties
properties, thus `ServerProperties` has `prefix="server"` and its configuration properties
are `server.port`, `server.address` etc. In a running Actuator app look at the
are `server.port`, `server.address` etc. In a running Actuator app look at the
`configprops` endpoint.
`configprops` endpoint.
* Look for use of `RelaxedPropertyResolver` to pull configuration values explicitly out of the
* Look for uses of the `bind` method on the `Binder` to pull configuration values explicitly out of the
`Environment`. It often is used with a prefix.
`Environment` in a relaxed manner. It is often is used with a prefix.
* Look for `@Value` annotations that bind directly to the `Environment`. This is less
* Look for `@Value` annotations that bind directly to the `Environment`.
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
* Look for `@ConditionalOnExpression` annotations that switch features on and off in
response to SpEL expressions, normally evaluated with placeholders resolved from the
response to SpEL expressions, normally evaluated with placeholders resolved from the
`Environment`.
`Environment`.
...
@@ -483,7 +480,7 @@ The appendix includes an <<appendix-application-properties#common-application-pr
...
@@ -483,7 +480,7 @@ The appendix includes an <<appendix-application-properties#common-application-pr
`application.properties`>> example with a list of the most common properties supported by
`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
Spring Boot. The definitive list comes from searching the source code for
`@ConfigurationProperties` and `@Value` annotations, as well as the occasional use of
`@ConfigurationProperties` and `@Value` annotations, as well as the occasional use of
`
RelaxedPropertyResolv
er`.
`
Bind
er`.
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
4e8592ff
...
@@ -1100,15 +1100,40 @@ The following properties names can all be used:
...
@@ -1100,15 +1100,40 @@ The following properties names can all be used:
|Standard camel case syntax.
|Standard camel case syntax.
|`person.first-name`
|`person.first-name`
|
Dashed notation
, recommended for use in `.properties` and `.yml` files.
|
Kebab-case
, recommended for use in `.properties` and `.yml` files.
|`person.first_name`
|`person.first_name`
|Underscore notation, alternative format for use in `.properties` and `.yml` files.
|Underscore notation, alternative format for use in `.properties` and `.yml` files.
|`PERSON_FIRST
_
NAME`
|`PERSON_FIRSTNAME`
|Upper case format. Recommended when using a system environment variables.
|Upper case format. Recommended when using a system environment variables.
|===
|===
NOTE: The `prefix` value for the annotation must be in kebab-case, ie, lowercase and separated by `-`.
.relaxed binding rules per property source
[cols="2,4,4"]
|===
| Property Source | Simple | List
|Properties Files
|Camel-case, kebab-case or underscore notation
|Standard list syntax using `[ ]` or comma-separated values
|YAML Files
|Camel-case, kebab-case or underscore notation
|Standard YAML list syntax or comma-separated values
|Environment Variables
|Upper case format with underscore as the delimiter. `_` should not be used within a property name
|Numeric values surrounded by underscores. eg: `MY_FOO_1_BAR = my.foo[1].bar`
|System properties
|Camel-case, kebab-case or underscore notation
|Standard list syntax using `[ ]` or comma-separated values
|===
TIP: We recommend that, when possible, properties are stored in lowercase kebab format. i.e. `my.property-name=foo`
[[boot-features-external-config-conversion]]
[[boot-features-external-config-conversion]]
...
@@ -1671,9 +1696,8 @@ use the `defaultValue` attribute.
...
@@ -1671,9 +1696,8 @@ use the `defaultValue` attribute.
</appender>
</appender>
----
----
TIP: The `RelaxedPropertyResolver` is used to access `Environment` properties. If specify
NOTE: The `source` must be specified using kebab-case (`my.property-name`). However, properties can be added to the
the `source` in dashed notation (`my-property-name`) all the relaxed variations will be
`Environment` using the relaxed rules.
tried (`myPropertyName`, `MY_PROPERTY_NAME` etc).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment