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

后端 未结 11 1628
借酒劲吻你
借酒劲吻你 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

    Michael Yin's answer is correct but a better explanation seems to be required!

    A lot of you mentioned that -D is the correct way to specify JVM parameters and you are absolutely right. But Michael is also right as mentioned in Spring Boot Profiles documentation.

    What is not clear in the documentation, is what kind of parameter it is: --spring.profiles.active is a not a standard JVM parameter so if you want to use it in your IDE fill the correct fields (i.e. program arguments)

提交回复
热议问题