汽配网站开发,宁波房产交易信息网官网,wordpress部署云,企业品牌营销型网站建设在公司项目开发中由于SpringBoot启动类配置了setAllowCircularReferences为true在特定的业务逻辑下需要该配置#xff0c;但我们需要使用SpringBootTest单元测试的时候引入我们开发的配置文件发现不生效#xff0c; 解决方法#xff1a;
SpringBootTest(properties …在公司项目开发中由于SpringBoot启动类配置了setAllowCircularReferences为true在特定的业务逻辑下需要该配置但我们需要使用SpringBootTest单元测试的时候引入我们开发的配置文件发现不生效 解决方法
SpringBootTest(properties spring.main.allow-circular-referencestrue)
public class ApplicationTests {Testvoid contextLoads() {// 测试上下文加载}
}或
SpringBootTest
public class ApplicationTests {static {System.setProperty(spring.main.allow-circular-references, true);}Testvoid contextLoads() {// 测试上下文加载}
}