在spring boot 1.5 版本之前

在@ConfigurationProperties注释中有两个属性:
locations:指定配置文件的所在位置
prefix:指定配置文件中键名称的前缀

 

spring boot1.5以上版本@ConfigurationProperties取消location属性

Springboot高版本中@ConfigurationProperties注解取消location属性

替代方案是:

在配置类中采用@Component的方式注册为组件,然后使用@PropertySource来指定自定义的资源目录

Springboot高版本中@ConfigurationProperties注解取消location属性

--------------------------------------------------------

以上均为转载内容,仅供个人学习记录,侵删

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-27
  • 2021-11-12
  • 2022-12-23
  • 2021-06-10
  • 2021-06-08
  • 2021-07-21
相关资源
相似解决方案