spring junit测试找不到SpringJUnit4ClassRunner.class

pom.xml配置如下:


  4.0.0
  com.lai.aop
  aop
  0.0.1-SNAPSHOT
 
 
    
   junit
   junit
   4.11
   test
  

   
   
   org.slf4j
   slf4j-log4j12
   1.6.4
  

  
  
   org.springframework
   spring-context
   4.2.4.RELEASE
  

  
   org.springframework
   spring-beans
   4.2.4.RELEASE
  

  
   org.springframework
   spring-webmvc
   4.2.4.RELEASE
  

  
   org.springframework
   spring-jdbc
   4.2.4.RELEASE
  

  
   org.springframework
   spring-aspects
   4.2.4.RELEASE
  

  
   org.springframework
   spring-jms
   4.2.4.RELEASE
  

   
            org.springframework  
            spring-test  
            4.2.4.RELEASE  
       

  
   org.springframework
   spring-context-support
   4.2.4.RELEASE
  

 

仔细一看,没什么错误,但是就是@RunWith(SpringJUnit4ClassRunner.class)报错,找不到SpringJUnit4ClassRunner.class。

再仔细一看

 
            org.springframework  
            spring-test  
            4.2.4.RELEASE  
       

版本4.2.4之前有空格,删除空格后就能用了。

总结:在使用Maven的过程中,pom.xm中jar包的配置别出现空格。


你可能感兴趣的:(java)