在我的工作中,application.yml 中的字段是动态的,每个开发人员都有另一个(动态)配置。因此,我们有与我们所有人相关的一般 yml 部分(并且不时更新)和“私人资料”
像这样:
spring:
profiles: default
configuration:
...
...
spring:
profiles: development1
configuration: ...
spring:
profiles: development2
configuration: ...
Run Code Online (Sandbox Code Playgroud)
我们在这方面有“小”问题(错误、冲突等),我们正在寻找解决方案。我为每个开发人员考虑单独的 yml 文件,例如:
spring:
profiles: development1
configuration:
yml-file: app_dev1.yml
spring:
profiles: development2
configuration:
yml-file: app_dev2.yml
Run Code Online (Sandbox Code Playgroud)
但没有找到如何做到这一点......
会很高兴知道它是否可以完成?(或者您有另一种方法来分隔我们之间的 yml)。
我们不想设置带有注释的应用程序 yaml(再次出现 git 问题..),例如Environment Variables...
Spring boot 默认加载,application.yaml但另外如果你运行--spring.profiles.active=dev1它会加载文件application-dev1.yaml
所以你可以为每个开发人员创建 yaml 文件+在 application.yaml
使用这种方法,您将不需要像这样的行:
spring:
profiles: dev1
Run Code Online (Sandbox Code Playgroud)
...在任何 yaml 文件中
| 归档时间: |
|
| 查看次数: |
198 次 |
| 最近记录: |