6

We use environment variables to configure various properties in Spring Boot applications. I found that binding a environment variable FOO_BAR_BAZ via @Value(${foo.bar.baz}) works out of the box in Spring Boot 1.4.3.RELEASE / Spring 4.3.5.RELEASE.

However, from what I read in the [relaxed binding documentation][1], this seems to be officially supported only for @ConfigurationProperties.

So my question is, do I have to expect that the observed behaviour (as described above) goes away with a future release?

[1]: https://docs.spring.io/spring-boot/docs/1.4.3.RELEASE/reference/htmlsingle/#boot-features-external-config-relaxed-binding, https://docs.spring.io/spring-boot/docs/1.4.3.RELEASE/reference/htmlsingle/#boot-features-external-config-vs-value

wwerner
  • 4,227
  • 1
  • 21
  • 39

1 Answers1

3

Some simple relaxed bindings seem to work with @Value. Check the following discussion for more info: https://github.com/spring-projects/spring-boot/issues/4413

yamenk
  • 46,736
  • 10
  • 93
  • 87