请问,在Junit测试时使用Spring的@ContextConfiguration注解怎么会出现这样的出错?

张三寺地 2013-04-12 06:39:55


Multiple markers at this line
- The type org.springframework.context.ApplicationContextInitializer cannot be resolved. It is indirectly referenced from required .class files
- The type org.springframework.context.ApplicationContextInitializer cannot be resolved. It is indirectly referenced from required .class files


求解决方案,更求原因。先谢了
...全文
37204 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Everlasting丶幻 2014-08-08
  • 打赏
  • 举报
回复
这个问题我解决了。jar包的版本不对、3.0的版本都没有这个.ApplicationContextInitializer类、
free_boys 2013-05-23
  • 打赏
  • 举报
回复
添加spring-context-3.2.2.RELEASE.jar
张三寺地 2013-04-12
  • 打赏
  • 举报
回复
引用 1 楼 feier00 的回复:
srccode
package cn.itcast.test; import java.util.List; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import cn.itcast.pojo.Student; @RunWith(value = SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "applicationContext.xml") public class StudentMapperTest { @Autowired private StudentMapper studentMapper; @Transactional public void getStudentTest() { } }
张三寺地 2013-04-12
  • 打赏
  • 举报
回复
package cn.itcast.test; import java.util.List; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import cn.itcast.pojo.Student; @RunWith(value = SpringJUnit4ClassRunner.class) @ContextConfiguration(value = "applicationContext.xml") public class StudentMapperTest { @Autowired private StudentMapper studentMapper; @Transactional public void getStudentTest() { } }
跳蚤图 2013-04-12
  • 打赏
  • 举报
回复
srccode

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧