【问题标题】:spring-boot Remove locations attributes from @ConfigurationPropertiesspring-boot 从@ConfigurationProperties 中删除位置属性
【发布时间】:2017-06-24 07:25:15
【问题描述】:

从@ConfigurationProperties 中移除位置属性

有什么选择?

我以前也这样用过。

@ConfigurationProperties(locations = "a.yml")

【问题讨论】:

标签: spring-boot configuration


【解决方案1】:

同样的问题:我们在几个 yaml 文件上有数百个配置键,每个配置键都方便地映射到我们注入业务逻辑 bean 的 pojo。

我可以做的最好的事情是升级到 Spring Boot 1.5,同时保持我们的生产应用程序在没有太多重构的情况下运行,如下所述:http://fabiomaffioletti.me/blog/2016/12/20/spring-configuration-properties-handle-deprecated-locations/

或者,如果这对您不起作用,您可以尝试这种更简单的方法,即使需要更多重构(删除 @ConfigurationProperties 注释):http://fabiomaffioletti.me/blog/2017/02/09/spring-configuration-properties-locations-deprecation-another-approach/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-09
    • 2022-01-12
    • 2019-09-16
    • 1970-01-01
    • 2020-02-10
    • 2019-03-04
    • 2015-06-17
    • 2018-02-07
    相关资源
    最近更新 更多