spingboot项目下的空指针异常:NullPointerException 在使用MyBatisPlus的service进行增删改查的时候,出现了空指针异常,原因是 @Autowired UserService userService; 自动注入失败 经过排查,@Service注解没有忘写。 最后在启动类上面加个全盘扫描,@ComponentScan(“”)里面写扫描路径 @ComponentScan("com.zhy.service")