nagy.zsolt.hun
nagy.zsolt.hun

Reputation: 6694

Spring Boot - program arguments in application.properties

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

Answers (1)

Ivan
Ivan

Reputation: 8758

You just need to pass your properties like -Dredis.host=localhost.

java -Dredis.host=localhost -jar <your jar>

Upvotes: 3

Related Questions