解决Mybatis-Plus抛出java.lang.NullPointerException异常
1.IDEA在 userMapper 处报错,因为找不到注入的对象,因为类是动态创建的,但是程序可以正确
的执行。为了避免报错,可以在mapper接口上添加 @Repository 注解
插入@Repository 注解
@Repository 注解后
2.解决@Autowired注入失效出现java.lang.NullPointerException
运行报错:
在类上插入@RunWith(SpringRunner.class)注解后:
这个添加@RunWith(SpringRunner.class)注解灵感来源于:https://blog.csdn.net/weixin_44788220/article