如何在IntelliJ中设置spring active profile环境变量

Ayu*_*yub 8 intellij-idea maven spring-boot

我在eclipse中使用spring boot应用程序(maven项目).当我运行maven项目的测试清理目标时,我想加载活动的配置文件

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

或者在IntelliJ IDE的命令行选项中将此属性设置为-Dspring.profiles.active = test,当命令为test clean时,aop没有效果.我也尝试在智能中设置Runner的JVM参数

但是当从IntelliJ IDE执行测试用例类时,@ ActiveProfiles("test")有效(右键单击 - >运行TestCaseClass).

有线索吗?

sgr*_*lon 15

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

在此输入图像描述

在此输入图像描述