0
我写一些JUnits的Spring应用程序,使用的弹簧版本是春瓶版本带有弹簧试验
<spring.version>3.2.8.RELEASE</spring.version>
的依赖关系被定义为
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
然后在我JUnit
测试我使用的注释为
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:config/test-application-context-datasource.xml")
当我试图执行测试ca SE它初始化失败,也就是说,它甚至没有进入@Before
方法和抛出异常如下:
java.lang.NoClassDefFoundError: org/springframework/core/type/AnnotatedTypeMetadata
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:118)
AnnotatedTypeMetadata只有弹簧释放4.10.0我相信后可用,但因为我没有使用任何地方在我的应用程序中,我的spring-test和spring-core的版本是相同的,为什么这甚至会被引用。
有什么想法?