Spring boot 2.2.0测试:配置错误:找到@BootstrapWith的多个声明

问题描述 投票:0回答:1
@RunWith(SpringRunner.class)
@SpringBootTest(classes=MyApplication.class)
@TestPropertySource(locations = "classpath:test-application.properties")
@WebAppConfiguration
@RestClientTest(Controller.class)
public class MyIntegrationTest {

}

当我运行此程序时,出现以下错误java.lang.IllegalStateException:配置错误:为测试类找到了@BootstrapWith的多个声明

java spring spring-boot spring-restcontroller spring-boot-test
1个回答
0
投票
似乎您的测试上至少有一个太多的Spring测试注释。

您到底想测试什么?如果确实只有RestClientTest,则应该可以使用:

@RunWith(SpringRunner.class) @TestPropertySource(locations = "classpath:test-application.properties") @RestClientTest(Controller.class) public class MyIntegrationTest { }

© www.soinside.com 2019 - 2024. All rights reserved.