前情提要:
某日,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