Servlet.service() for servlet [springmvc] in context with path [/PenMan] threw exception [Request pr

报错信息:

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

原因:一个用spring IOC自动注入的类实例化没有加@Resource注释

@Service
public class ForwardServiceImpl implements ForwardService {
	@Resource//就是这忘加了
	private LoginMapper loginMapper;
	@Override
	public Login code(Login login) {
		// TODO 自动生成的方法存根
		return loginMapper.login(login);
	}

我是看了这个博客才发现的

你可能感兴趣的:(java编程错误)