Spring use one application.properties for production and another for debug

后端 未结 2 2017
盖世英雄少女心
盖世英雄少女心 2020-12-29 21:14

I have a Spring application and I would like to be able to switch between configurations depending if I\'m debugging the server or if the server is running in production. (t

2条回答
  •  青春惊慌失措
    2020-12-29 21:41

    Spring profiles seem the way to go. You can start your application with something like -Dprofile=. Have a look at this example.

    EDIT: after re-reading your question, I came to the conclusion that you might actually want something more basic: put your database properties externally. Depending on your application you could use @Value of a property configurator. Have a look at the spring docs.

提交回复
热议问题