我有一个已经配置了spring cloud config的应用程序,我想通过jvm agrument来运行这个应用程序:
bootsrap.yml配置
spring.application.name: app
spring.cloud.config:
enabled: ${SPRING_CONFIG_ENABLED:false}
uri: ${SPRING_CONFIG_URI:http://ip:9097/}我想像这样传递参数,但不是工作:
gradle bootRunLocal -DSPRING_CONFIG_ENABLED=true -DSPRING_CONFIG_URI=http://localhost:9097/发布于 2020-05-10 10:17:49
尝试在build.gradle文件中配置引导任务,如下所示:
bootRun {
systemProperties System.properties
}发布于 2020-05-10 22:43:51
我通过在bootRun中添加以下代码来解决此问题:
bootRun {
if (project.hasProperty('args')) {
args project.args.split(',')
}
}要运行任务:
gradle bootRun -Pargs=--spring.profiles.active=local,--SPRING_CONFIG_ENABLED=true,--SPRING_CONFIG_URI=http://localhost:9097/https://stackoverflow.com/questions/61706266
复制相似问题