spring junit测试找不到SpringJUnit4ClassRunner.class
来源:互联网 发布:记录恋爱的软件 编辑:程序博客网 时间:2024/06/06 03:55
pom.xml配置如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lai.aop</groupId>
<artifactId>aop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
</dependencies>
</project>
仔细一看,没什么错误,但是就是@RunWith(SpringJUnit4ClassRunner.class)报错,找不到SpringJUnit4ClassRunner.class。
再仔细一看
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
版本4.2.4之前有空格,删除空格后就能用了。
总结:在使用Maven的过程中,pom.xm中jar包的配置别出现空格。
- spring junit测试找不到SpringJUnit4ClassRunner.class
- Class<SpringJUnit4ClassRunner> cannot be resolved to a type spring4.32的junit测试报错解决
- java测试注解(@RunWith(value = SpringJUnit4ClassRunner.class) )
- java测试注解(@RunWith(value = SpringJUnit4ClassRunner.class) )
- @RunWith (SpringJUnit4ClassRunner.class) error
- 关于在eclipse中使用Spring+JUnit时,JUnit找不到测试类的问题
- Junit测试中找不到junit.framework.testcase
- 在使用junit进行功能测试的时候,遇到SpringJUnit4ClassRunner requires JUnit4.12 or higher
- springjunit 测试类SpringJUnit4ClassRunner
- @RunWith(SpringJUnit4ClassRunner.class)报错
- JUnit 测试 Spring
- spring junit 测试
- Spring的Junit测试
- spring junit测试
- spring junit集成测试
- spring junit集成测试
- junit 测试 spring
- Spring与junit测试
- libvmi安装_Ubuntu_14.04
- python学习之路-基础篇-函数-day03
- Python库之Requests(iMooc)---(3)
- Python读取txt内容写入xls格式的excel中
- UVA10003CuttingSticks
- spring junit测试找不到SpringJUnit4ClassRunner.class
- 电脑开机显示checking file system on c
- BFPRT算法(求前k个小的数)-Java实现
- 利用powerDesigner16.5连接oracle数据库并自动生成表结构图
- redis清空数据
- 使用javaMail进行腾讯,新浪,网易网上邮箱验证
- DNS服务器
- HDU 6068 Classic Quotation(kmp+dp)
- 初识nodejs6