Saturday, December 17, 2016

Passing Spring properties file in command line

Normally we bake the application.properties file in Spring which is not a good idea for all the properties. It's better to externalize them so that the environment variables like database connection details can be passed to the Spring application from outside

For that start your Spring based application with the following command

java -jar application.jar  --spring.config.name=application

The properties file need to be present in the location from where you are firing the command.


No comments:

Post a Comment