【发布时间】:2020-01-21 15:04:56
【问题描述】:
我正在尝试从 maven 学习使用带有 springboot 的 gradle,所以我想知道如何在命令行中运行我的项目以获取不同的配置文件。 这里的场景是我有我的属性,例如。
application-qa.properties 和 application.properties
但是,如果使用 ./gradlew -PspringProfile=qa bootRun 之类的东西运行 gradle
它仅加载 application.properties 中的默认属性,而不加载 qa 属性。
我如何像之前使用 maven 一样使用 gradle 来实现这一点?
这是我尝试过的。 我在 IntelliJ 中创建了 gradle 运行配置,但这也没有用,
有命令行选项吗?
【问题讨论】:
-
属性名称是
spring.profiles.active,而不是springProfile -
@ThisIsNoZaku,已更改为默认值,但仍会选择默认值
标签: spring-boot gradle gradlew