Spring错误-kob-Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exc

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

看了数据库id 不为null,主键等都设置了

没加

@Autowired@Autowired注释:它可以对类成员变量、方法及构造函数进行标注,完成自动装配的工作。==>自动注入依赖的Bean。一个AutoWired只能接管一个bean

错误

*******每一个声明都要一个@Autowired

太开心了

@Autowired//注入数据库
private UserMapper userMapper;
@Autowired
private PasswordEncoder passwordEncoder;

Spring错误-kob-Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exc_第1张图片

参考

报错解决:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception-CSDN博客

你可能感兴趣的:(Spring,spring,servlet,java)