记一次mybatis的classpath踩坑记录


前情提要:

某日,M君外出办事,结果去早了,店家未开门。
见寒风凛冽,遂溜进一网吧。打开电脑欲大战机器人一把。
结果看到群内某男问了一个springmvc问题,M君按耐不住。欲解之,故有了下文。。。


问题描述:

环境:Spring+SpringMVC+Mybatis,Maven构建
异常:Install时,

[org.springframework.test.context.TestContextManager]Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@4a4038e2] to prepare test instance [sy.test.TestMybatis@6e030872]
java.lang.IllegalStateException: Failed to load ApplicationContext

起初一眼认定 ,测试用例TestMybatis里面的spring.xml路径配置错了。
于是你来我往聊了半天,没说出个所以然。再加上对maven不是非常熟悉,于是去看了看maven方面spring.xml配置文件的路径问题,发现应该是对的。
又问: service注解写了没啊?scan service的spring xml文件是哪个啊,有问有给进去啊?都没问题。
这下有点摸不着头脑了。

思索一小会儿,让其把完整异常发来。打开文件的瞬间一万个尼玛飞过。
大哥,你TM发异常能发完整不?
你可知道这会整死人不?
这里写图片描述

[org.springframework.test.context.TestContextManager]Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@4a4038e2] to prepare test instance [sy.test.TestMybatis@6e030872]
java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
    at org.springframework.test.context.web.ServletTestExecutionListener.s
  • 16
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 23
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 23
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值