How to override application.properties during production in Spring-Boot?

后端 未结 8 849
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 13:00

I\'m using spring boot and application.properties to select a database during development by @Configuration @Profile(\"dev\").

spri         


        
8条回答
  •  执笔经年
    2020-12-04 13:56

    The spring configuration precedence is as follows.

    1. ServletConfig init Parameter
    2. ServletContext init parameter
    3. JNDI attributes
    4. System.getProperties()

    So your configuration will be overridden at the command-line if you wish to do that. But the recommendation is to avoid overriding, though you can use multiple profiles.

提交回复
热议问题