service层调用dao层时报错java.lang.NullPointerException的解决办法

错误:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

debug:

发现在service层调用dao层插入时崩了,一脸懵逼。
在这里插入图片描述

结决办法:

原来是引入 private ClassRoomDoMapper classRoomDoMapper; 时忘了加
@Autowired 注解 导致无法自动装配bean 加上注解问题解决

在这里插入图片描述

发布了34 篇原创文章 · 获赞 3 · 访问量 981

猜你喜欢

转载自blog.csdn.net/qq_41870790/article/details/103100075