ssm整合mybatis报错NPE?

问题描述

使用springframework框架整合mybatis后在测试类中发现无法注入service,报npe
image.png

环境:
idea
spring + springmvc + mybatis
maven

所作努力

看网上大部分说测试类头顶缺失@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations = {"classpath:application.xml"})两大注解,遂加之,报找不到测试类

警告: Runner org.junit.internal.runners.ErrorReportingRunner (used on class MyTest) does not support filtering and will therefore be run completely.

org.junit.runners.model.InvalidTestClassError: Invalid test class 'MyTest':
  1. No runnable methods

网上解决方案大多都是如博客https://blog.csdn.net/qq_43012792/article/details/107775607,无法解决
https://weibgg.blog.csdn.net/article/details/103112618,无法解决

完整代码下载

链接: https://caiyun.139.com/m/i?0d5Crf9pDyyQY 提取码:T43K

阅读 1.8k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进