解决方案:
使用 Map 传参 不使用 HttpServletRequest
之前
@RequestMapping("/hello2")
public String hello2(HttpServletRequest request) {
request.setAttribute("user", new User("zhangsan", 23));
return "hello2";
}
之后
@RequestMapping("/hello2")
public String hello2(Map<String,Object> result) {
result.put("user", new User("zhangsan", 23));
return "hello2";
}