As I understand from your question, you want to use application.properties for your development. But you do not want to use it for production.
I would suggest using Spring profiles to achieve this. In the properties file
- Create a profile for development. Put all your development properties in it.
- Do not create a profile to create in the properties file.
- When you are developing, set the active profile for development so that properties are loaded from your application.properties file.
- When you run it in the production process, set the active profile to "Production". Although application.properties will be loaded into your WAR, since there is no profile for production, none of the properties will be loaded.
I did something similar using YML. I am sure there should be a way to do the same using the .properties file.
spring: profiles.active: development -- spring: profiles: development something: location: USA unit1: Test1 unit2: Test2
You can change the profile at runtime using
-Dspring.profiles.active=production
source share