如何在 application.properties
中包含程序参数?
例如:java Dspring-boot.run.arguments=--redis.host=localhost -jar build/libs/app.jar
应用程序属性:
spring.redis.url=redis://${redis.host}:6379
是否可以将 ${redis.host} 替换为来自程序参数的值? (示例中为本地主机)
最佳答案
您只需传递您的属性,如 -Dredis.host=localhost
.
java -Dredis.host=localhost -jar <your jar>
关于java - Spring Boot - application.properties 中的程序参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54136069/