.yml文件是这样配置
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: HTML5
encoding: UTF-8
servlet:
content-type: text/html
cache: false
check-template-location: true
依赖我也在pom文件加了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
index.html文件是放在resources目录下的templates下
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index(){
return "index";
}
我这么访问 http://localhost:8080/admin/index
但是报错了,报了
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Mar 13 11:55:25 CST 2020
There was an unexpected error (type=Internal Server Error, status=500).
Circular view path [index]: would dispatch back to the current handler URL [/admin/index] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
可以参考我的相关文章