spring引导:将application.yml文件拆分为多个文件

mnowg1ta  于 2021-07-15  发布在  Java
关注(0)|答案(0)|浏览(349)

我有一个 application.yml 像这样的

app:
 mappings:
  - name: "abc"
    state: "MH"
    age: "18"
  - name: "bcd"
    state: "MH"
    age: "18"
  - name: "xyz"
    state: "MP"
    age: "20"

我正在用 @ConfigurationProperties 到dto。
我们要的是把这个分开 application.yml 因为这个列表可能很长,所以可以将其转换为多个文件以使其更具可读性和可管理性。
像这样的

app:
 mappings:
  - application-state-mh.yml
  - application-state-mp.yml

应用程序状态-mh.yml

key:
  - name: "abc"
    state: "MH"
    age: "18"
  - name: "bcd"
    state: "MH"
    age: "18"

应用程序状态-mp.yml

key:
  - name: "xyz"
    state: "MP"
    age: "20"

我怎样才能做到这一点?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题