File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
spring-boot-docs/src/main/asciidoc Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -543,13 +543,18 @@ definitions by simply listing the properties classes directly in the
543
543
544
544
545
545
[[boot-features-external-config-relaxed-binding]]
546
- ==== Relaxed binding
546
+ ==== Relaxed binding (Properties format)
547
547
Spring Boot uses some relaxed rules for binding `Environment` properties to
548
548
`@ConfigurationProperties` beans, so there doesn't need to be an exact match between
549
549
the `Environment` property name and the bean property name. Common examples where this
550
550
is useful include underscore separated (e.g. `context_path` binds to `contextPath`), and
551
551
capitalized (e.g. `PORT` binds to `port`) environment properties.
552
552
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
+
553
558
Spring will attempt to coerce the external application properties to the right type when
554
559
it binds to the `@ConfigurationProperties` beans. If you need custom type conversion you
555
560
can provide a `ConversionService` bean (with bean id `conversionService`) or custom
You can’t perform that action at this time.
0 commit comments