启用spring boot项目时,查看是否少了解析Ajax注解
修改前
浏览器报出如下错误
解决方案:
加入@ResponseBody 注解
@Controller
public class StudentController {
@Resource
private StudentService studentService;
@RequestMapping("/query")
@ResponseBody //加入解析Ajax注解
public String queryStudent(){
Student student = studentService.queryStudent(123);
return student.toString();
}
}