SpringBoot 多环境部署

guanchaoguo / 2023-05-31 / 原文

多个配置文件

  • application.yaml
  • application-dev.yaml
  • application-test.yaml
  • application-prod.yaml

加载顺序

  • 默认加载 application.yaml
  • profiles.active ==dev 合配置

使用不同配置

  • application.yaml 中 profiles.active:dev
  • nohup java -Duser.timezone=Asia/Shanghai -jar -Dspring.profiles.active=prod app.jar > start1.log 2>&1 &