【发布时间】:2015-05-20 17:04:43
【问题描述】:
我正在使用 spring-boot: 1.2.2
这是docs 中提供的语法(当我开始使用该命令时,我得到Unknown command-line option '--spring.profiles.active'.)
gradlew bootRun --spring.profiles.active=noAuthentication
我试过了,但是不行
gradlew bootRun -Dspring.profiles.active=noAuthentication
我在其他地方发现这应该可以,但它没有
gradlew bootRun -Drun.jvmArguments="-Dspring.profiles.active=noAuthentication"
我在 application.properties 中添加了以下内容,它可以正常工作。
spring.profiles.active=noAuthentication
如何从命令行传递这个参数?
【问题讨论】:
-
您将命令行参数传递给 Gradle,而不是您的 Spring Boot 应用程序。请参阅此答案以了解如何通过 Gradle bootRun stackoverflow.com/questions/25079244/… 将 args 传递给应用程序
标签: spring-boot