如何找出哪个弹簧组件不兼容?

我正在尝试使用 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.RELEASE

SpringSecurityWeb = 4.0.2.RELEASE

SpringWeb = 4.3.6.RELEASE

SpringWebMVC = 4.3.6.RELEASE

SpringBootTestAutoConfigure = 1.4.0.RELEASE

SpringSecurityTest = 4.0.2.RELEASE

SpringContextVersion = 4.1.7.RELEASE

SpringTestVersion = 4.3.6.RELEASE

SpringBootTestVersion = 1.2.5.RELEASE

SpringBootStarterVersion = 1.2.5.RELEASE

SpringDataRedisVersion = 1.6.4.RELEASE

SpringRetryVersion = 1.2.0.RELEASE

SpringDataJpaVersion = 1.8.0.RELEASE

我如何确定其中哪些不兼容?


拉风的咖菲猫
浏览 151回答 1
1回答

守着一只汪

跑步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.RELEASESpringBootStarterVersion = 1.2.5.RELEASE    depends on spring-boot:1.2.5.RELEASE and spring-core:4.1.7.RELEASE
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java