would dispatch back to the current handler URL [/student] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
意思:会再次分派回当前处理程序URL [/student]。检查你的视图解析器设置!(提示:这可能是一个未指定视图的结果,由于默认视图名称的生成。
错误代码:
@Controller
@RequestMapping("/student")
public class StudentController {
@Autowired
private StudentService studentService;
@GetMapping
public List<Student> findAll(){
return studentService.findAll();
}
@DeleteMapping("/{id}")
public boolean del(@PathVariable int id){
boolean flas=true;
if (flas){
System.out.print("删除成功");
}else {
System.out.print("删除失败");
}
return flas;
}
}
解决问题:
@Controller把这个注解改成@RestController