1、不同环境使用不同配置
    例如数据库配置,在开发的时候,我们一般用开发数据库,而在生产环境的时候,我们是用正式的数据
2、配置文件存放路径
    classpath根目录的“/config”包下
    classpath的根目录下
3、spring boot允许通过命名约定按照一定的格式(application-{profile}.properties)来定义多个配置文件


SpringBoot多环境配置_经验分享

 

 

多个配置文件

SpringBoot多环境配置_SpringBoot_02

 

application.properties:

#springboot多环境配置======begin
test.url=local

#指定哪个profile
spring.profiles.active=dev
#springboot多环境配置======end

application-dev.properties