[英]Spring Boot - program arguments in application.properties
How can I include program arguments in application.properties
? 如何在application.properties
包含程序参数?
For example: java Dspring-boot.run.arguments=--redis.host=localhost -jar build/libs/app.jar
例如: java Dspring-boot.run.arguments=--redis.host=localhost -jar build/libs/app.jar
application.properties: application.properties:
spring.redis.url=redis://${redis.host}:6379
Is it possible to replace ${redis.host} with the value coming from the program arguments? 是否有可能取代$ {} redis.host从程序参数来的价值? (localhost in the exampe) (示例中的本地主机)
您只需要传递-Dredis.host=localhost
类的属性-Dredis.host=localhost
。
java -Dredis.host=localhost -jar <your jar>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.