【发布时间】:2017-10-30 14:48:03
【问题描述】:
需要使用 spring 配置文件通过 gradle 运行测试。
gradle clean build
我已添加任务:
task beforeTest() {
doLast {
System.setProperty("spring.profiles.active", "DEV")
}
}
test.dependsOn beforeTest
而我的测试定义是:
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("TestProfile")
public class SomeTest {
但是这种结构对我不起作用。
Gradle 运行测试。
【问题讨论】:
标签: java spring gradle profiling spring-profiles