Reputation: 6694
How can I include program arguments in application.properties
?
For example: java Dspring-boot.run.arguments=--redis.host=localhost -jar build/libs/app.jar
application.properties:
spring.redis.url=redis://${redis.host}:6379
Is it possible to replace ${redis.host} with the value coming from the program arguments? (localhost in the exampe)
Upvotes: 0
Views: 1231
Reputation: 8758
You just need to pass your properties like -Dredis.host=localhost
.
java -Dredis.host=localhost -jar <your jar>
Upvotes: 3