//依赖注入
@Autowired //如果没有使用注解注入,而直接使用,会报空指针异常.
private UserService userService;
@RequestMapping(value="/user/check/{param}/{type}")
@ResponseBody
public E3Result checkData(@PathVariable String param, @PathVariable Integer type) {
//这里会因为没有注入userService而报空指针异常.
E3Result result = userService.checkData(param, type);
return result;
}
关于空指针异常的讲解:空指针异常讲解