错误信息
发生问题的原因
// An test code
thymeleaf:
prefix: classpath:/templates/
路径为 classpath: 下面 /templates/
@GetMapping(value = "/role_list")
public String list(Model model){
model.addAttribute("roles",roleService.selectAllRole());
return "/role/role_list";
}
return 的路径为 /role/role_list
这样就导致解析的时候路径相加为 /templates//role/role_list
解决方法
删除上面两处中某一处多余的斜杠
比如修改 /templates/ 为 /templates
// An test code
thymeleaf:
prefix: classpath:/templates
警告:如果删除配置文件里的斜杠,就不要删除return路径的斜杠,或者反之
红波浪线消失