Spring boot external application.properties

前端 未结 5 670
长发绾君心
长发绾君心 2020-12-15 22:20

I am developing a spring boot application

I want to override some properties in src/main/resources/application.properties with an external file (e.g.

5条回答
  •  醉梦人生
    2020-12-15 22:51

    If you do not want to use any solution from above, you could do the following in the start of your main(String args[]) method (before the usage of SpringApplication.run(MyClass.class, args):

    //Specifies a custom location for application.properties file.
    System.setProperty("spring.config.location", "target/config/application.properties");
    

提交回复
热议问题