【问题标题】:how to set spring active profile environment variable in IntelliJ如何在 IntelliJ 中设置 spring 活动配置文件环境变量
【发布时间】:2017-05-05 19:16:31
【问题描述】:

我在 Eclipse 中使用 Spring Boot 应用程序(maven 项目)。当我运行 maven 项目的 test clean 目标时,我想加载活动配置文件

我在 application.properties 和 application-test.properties 中添加了属性 spring.profiles.active=test,aop,这没有任何影响。

或在 IntelliJ IDE 的命令行选项中将此属性设置为 -Dspring.profiles.active=test,aop 在命令为 test clean 时不起作用。我也试过在 Intelligent 中设置 Runner 的 JVM 参数

但是,当从 IntelliJ IDE 执行测试用例类时,@A​​ctiveProfiles("test") 起作用(右键单击 -> 运行 TestCaseClass)。

有什么线索吗?

【问题讨论】:

  • 例如,设置 VM 选项 -Dspring.profiles.active=local 对我来说很好。

标签: maven intellij-idea spring-boot


【解决方案1】:

使用 -Dspring.profiles.active=test 设置 VM 选项

【讨论】:

  • 这在最新的 Spring Boot 中仍然准确吗?我听说他们更改了用于设置活动配置文件的属性名称。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-09
  • 2016-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-30
  • 2019-08-03
相关资源
最近更新 更多