Skip to content

Commit 05e4022

Browse files
committed
Mention environment variables mapping in the guide
Closes spring-projectsgh-2234
1 parent 96d479c commit 05e4022

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,18 @@ definitions by simply listing the properties classes directly in the
543543

544544

545545
[[boot-features-external-config-relaxed-binding]]
546-
==== Relaxed binding
546+
==== Relaxed binding (Properties format)
547547
Spring Boot uses some relaxed rules for binding `Environment` properties to
548548
`@ConfigurationProperties` beans, so there doesn't need to be an exact match between
549549
the `Environment` property name and the bean property name. Common examples where this
550550
is useful include underscore separated (e.g. `context_path` binds to `contextPath`), and
551551
capitalized (e.g. `PORT` binds to `port`) environment properties.
552552

553+
NOTE: Environment variables are usually underscore-separated and upper case so you can
554+
just use that and Spring Boot will bind it to your bean property names accordingly. For
555+
instance `MY_PROPERTY` will match just the same as `myProperty`, `my_property` or
556+
`my-property`.
557+
553558
Spring will attempt to coerce the external application properties to the right type when
554559
it binds to the `@ConfigurationProperties` beans. If you need custom type conversion you
555560
can provide a `ConversionService` bean (with bean id `conversionService`) or custom

0 commit comments

Comments
 (0)