How do I activate a Spring Boot profile when running from IntelliJ?

前端 未结 13 1747
醉梦人生
醉梦人生 2021-01-30 00:09

I have 5 environments:

 - local (my development machine)
 - dev
 - qc
 - uat
 - live
 - staging

I want different application properties to be u

13条回答
  •  感动是毒
    2021-01-30 00:35

    So for resuming...

    If you have the IntelliJ Ultimate the correct answer is the one provided by Daniel Bubenheim

    But if you don't, create in Run->Edit Configurations and in Configuration tab add the next Environment variable:

    SPRING_PROFILES_ACTIVE=profilename
    

    And to execute the jar do:

    java -jar -Dspring.profiles.active=profilename XXX.jar
    

提交回复
热议问题