真是鬱悶啊。明明已經添加了junit的依賴可是啓動服務的時候總是報錯java
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.spring
java.lang.ClassNotFoundException: org.junit.BeforeClassapache
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)app
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)spa
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:180)ssr
at org.springframework.asm.ClassReader.readAnnotationValues(ClassReader.java:1491)xml
at org.springframework.asm.ClassReader.readMethod(ClassReader.java:909)it
解決方案是將pom.xml的<scope>test</scope> 刪除:io
<dependency>asm
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
以前用的是spring3*版本版本也沒出現這個問題。到了spring4*就出這個問題了。