junit测试可以加载web.xml中的servlet么?如何加载?

【问题背景】:

1、spring+springMVC+hibernate项目。
2、编写测试用例暂未用到其他测试框架。
3、基于controller写的测试用例。
4、已在base测试类中spring运行器并加载spring配置文件,运行测试用例可获取到对应bean。

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:aop/applicationContext.xml"})

【问题】:在用例执行过程中,调用dao的方法中有调用外部配置在web.xml中servlet解析xml,但是此处未能加载到该servlet,导致用例执行失败。报错

无法加载spring上下文

已测试将该servlet配置到spring的bean中,但执行依旧不行。

【求助】
请问junit测试过程中是否可以通过加载web.xml来加载启动其中的servlet呢?如果可以怎么配置使用呢?

从运行机制上看,Junit 之所以能找到 Controller 的映射关系是因为配置文件所起的作用。
如果这些 Selrvlet 不是被 SpringMVC 托管的话,这里是会无法得到 Servlet 实例的。
可以用测试 Servlet 的框架,如 easymock ,https://blog.csdn.net/allen_oscar/article/details/8789917

https://www.oschina.net/question/2318972_2142231?sort=time