【发布时间】:2019-06-28 09:18:11
【问题描述】:
想检查 Spring boot 是否提供了使用除 application.properties 文件之外的配置文件的帮助。例如:my-custom.properties 文件,可以是特定配置文件,
例如:
-
my-custom-dev.propertiesdev 个人资料 -
my-custom-uat.propertiesuat 个人资料
编辑:问题是,我有正常的 application-{env}.property 文件,除此之外,还有其他属性文件根据它们的数据内容(例如:我想要的用于日志记录的 DB 特定属性存储在 `db-log.properties 中,如何使其他文件配置文件敏感?
【问题讨论】:
-
Spring Boot 参考指南中对here 进行了解释。简而言之,添加
--spring.config.name=application,file1,file2这将指示 Spirng Boot(可选)检测默认值旁边的file1.properties和 `file1-{profile}.properties。
标签: java spring spring-boot spring-profiles