If I want to run spring boot application, and want to use difference application.properties in difference path (other than using profile)

How can I specify path for application.properties?

3 Answers

1
Satish Kr On Best Solutions

If you want to use difference application.properties in difference path, use this command to start the jar file

nohup java -jar project.jar --spring.config.location=file://{file-path}/application.properties 
0
ruseel On
0
Community On

@PropertySource annotation is used to provide properties file into the environment and it is used with @Configuration classes.

@PropertySource({ "classpath:config.properties" })