多环境配置

作者: 红小豆你要坚强 | 来源:发表于2017-01-18 16:27 被阅读15次

在Spring Boot中多环境配置文件名需要满足application-{profile}.properties的格式,其中{profile}对应你的环境标识,比如:

application-dev.properties:开发环境

application-test.properties:测试环境

application-prod.properties:生产环境

需要在application.properties文件中通过spring.profiles.active属性来设置,其值对应{profile}值。

如:spring.profiles.active=test就会加载application-test.properties配置文件内容

各项参数配置的值以application.properties中指定的spring.profiles.active的值里面的属性值为准

相关文章

网友评论

    本文标题:多环境配置

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