使用SpringBoot2.0访问路径时,出现如下错误,记录一下
@RequestMapping("index2")
public String index2()
{
System.out.println("index2");
return "index2";
}
这里我的返回写成了 return "index2"
正确写法是 return "/index" 只需要加一个斜杠就可以了。
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Mar 15 18:58:52 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template [index2], template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [index2], template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.engine.TemplateManager.resolveTem