【发布时间】:2018-01-16 00:39:47
【问题描述】:
我们使用环境变量来配置 Spring Boot 应用程序中的各种属性。我发现通过 @Value(${foo.bar.baz}) 绑定环境变量 FOO_BAR_BAZ 在 Spring Boot 1.4.3.RELEASE / Spring 4.3.5.RELEASE 中开箱即用。
但是,根据我在 [宽松绑定文档][1] 中阅读的内容,这似乎仅在 @ConfigurationProperties 中得到官方支持。
所以我的问题是,我是否必须期望观察到的行为(如上所述)在未来的版本中消失?
[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
【问题讨论】:
标签: spring spring-boot spring-config