1、springBoot提供spring.profiles.active配置用于区分不同运行环境。
当我们项目需要根据运行的环境环境来读取不同配置文件时,可使用指定spring.profiles.active来读取对应的文件。

当配置的环境找不到是,则读取application.properties文件
比如:spring.profiles.active=dev1,则读取application.properties
spring.profiles.active=test则读取application-test.properties
下面是提供eclipse的配置方式,其他ide配置方式类似

网友评论