美文网首页
springboot 多个yml

springboot 多个yml

作者: NazgulSun | 来源:发表于2023-06-27 16:13 被阅读0次

问题

想要把一些复杂的配置项放在yml文件中,又不像全部放在application.yml中。
一开始使用propertySource 一直无法加载yml。原来propertySource 只能读取properties文件。
考虑到yml 可读性要强一些,还是希望使用yaml

解决方法:

https://www.baeldung.com/spring-boot-load-multiple-yaml-configuration-files

  1. 使用多个application-profile.yml
  2. 自定义propertySource的解析,支持yml文件。

相关文章

网友评论

      本文标题:springboot 多个yml

      本文链接:https://www.haomeiwen.com/subject/pkjnydtx.html