Reputation: 1734
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
?
Upvotes: 6
Views: 21873
Reputation: 96
use bellow code above main class:
@PropertySource(value = {"file:///${HOMEDIR}/application.properties"})
Upvotes: 0
Reputation: 628
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
Upvotes: 7
Reputation: 1
@PropertySource annotation is used to provide properties file into the environment and it is used with @Configuration classes.
@PropertySource({ "classpath:config.properties" })
Upvotes: 0