1.不使用thymeleaf
@RequestMapping("/")
public String hello(){
return "index";
}
spring:
mvc:
view:
suffix: .html
static-path-pattern: /**
resources:
static-locations: classpath:/templates/,classpath:/static/
2.使用thymeleaf,什么也不用配置
3.不使用thymeleaf
//或者直接访问/index.html
@RequestMapping("/")
public String hello(){
return "index.html";
}
spring:
resources:
static-locations: classpath:/templates/,classpath:/static/
以上几种方法才能从controller映射到html文件,显示html,可是为什么呢