1.profile是用来完成不同环境下,配置动态切换功能的。
2.profile配置方式
-多profile文件方式:提供多个配置文件,每个代表一种环境。
- application-dev.properties/yml 开发环境
- application-test.properties/ym 测试发环境
- application-pro.properties/yml 生产环境
-yml多文档方式:
- 在yml中使用 ---分隔不同配置
3.profile激活方式
-配置文件:在配置文件中配置:spring.profiles.active=dev
-虚拟机参数:在VMoptions指定在:-Dspring.profiles.active=dev
-命令行:java -jar xxx.jar --spring.profiles.active=dev