Setting active profile and config location from command line in spring boot

后端 未结 11 1629
借酒劲吻你
借酒劲吻你 2020-11-27 09:33

I have a spring boot application.

I have three profiles in my application-> development, staging and production. So I have 3 files

  1. ap
11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 10:21

    When setting the profile via the Maven plugin you must do it via run.jvmArguments

    mvn spring-boot:run -Drun.jvmArguments="-Dspring.profiles.active=production"
    

    With debug option:

    mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Dspring.profiles.active=jpa"
    

    I've seen this trip a lot of people up..hope it helps

提交回复
热议问题