我正在尝试使用 spring 和 gradle 为项目编写一些 junit 测试。我越来越java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) at org.springframework.boot.test.autoconfigure.AutoConfigureReportTestExecutionListener.prepareTestInstance(AutoConfigureReportTestExecutionListener.java:49) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)我被告知这可能是弹簧组件不兼容的问题。这些是我的 gradle.properties 中的那些SpringSecurityConfig = 4.0.2.RELEASESpringSecurityWeb = 4.0.2.RELEASESpringWeb = 4.3.6.RELEASESpringWebMVC = 4.3.6.RELEASESpringBootTestAutoConfigure = 1.4.0.RELEASESpringSecurityTest = 4.0.2.RELEASESpringContextVersion = 4.1.7.RELEASESpringTestVersion = 4.3.6.RELEASESpringBootTestVersion = 1.2.5.RELEASESpringBootStarterVersion = 1.2.5.RELEASESpringDataRedisVersion = 1.6.4.RELEASESpringRetryVersion = 1.2.0.RELEASESpringDataJpaVersion = 1.8.0.RELEASE我如何确定其中哪些不兼容?
1 回答
守着一只汪
TA贡献1872条经验 获得超3个赞
跑步
gradle dependencies --configuration compile
输出显示版本已更改的位置,例如spring-beans:4.1.6.RELEASE -> 4.1.7.RELEASE因为spring-security-web4.0.2 需要spring-beans4.1.6,但spring-boot-starter1.2.5 需要spring-core4.1.7
可能的冲突竞争者是:
SpringBootTestAutoConfigure = 1.4.0.RELEASE
depends on spring-boot:1.4.0.RELEASE and spring-core:4.3.2.RELEASE
SpringBootStarterVersion = 1.2.5.RELEASE
depends on spring-boot:1.2.5.RELEASE and spring-core:4.1.7.RELEASE
添加回答
举报
0/150
提交
取消