SSM框架普通类注入mapper接口,mapper接口初始化的类为NULL

因为spring加载顺序的问题,applicationcontext.getbean因为配置跑了一遍后bean已经创建好了,bean都成功织入。所以能够通过这个方法得到bean。但是你用普通的测试类是没有跑过配置,需要用spring整合的junit4

猜你喜欢

转载自www.cnblogs.com/doucunkai/p/8976179.html
今日推荐