1、真是郁闷啊。明明已经添加了junit的依赖但是启动服务的时候老是报错
2015-01-24 16:00:22 [org.springframework.core.type.classreading.AnnotationAttributesReadingVisitor]-[DEBUG] Failed to class-load type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: org.junit.BeforeClass
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:180)
at org.springframework.asm.ClassReader.readAnnotationValues(ClassReader.java:1491)
at org.springframework.asm.ClassReader.readMethod(ClassReader.java:909)
解决方案是将pom.xml的<scope>test</scope> 删除:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
之前用的是spring3*版本也没出现这个问题。到了spring4*就出这个问题了。