#在构建URL时添加到视图名称前的前缀(默认值:classpath:/templates/)
spring.thymeleaf.prefix=classpath:/templates/
# 添加此处配置通过controller跳转页面时将自动拼接后缀名
spring.thymeleaf.suffix=.html
spring.mvc.static-path-pattern = /static/**
spring.thymeleaf.check-template-location=true
spring.thymeleaf.cache=false
import org
.springframework
.context
.annotation
.Configuration
;
import org
.springframework
.web
.servlet
.config
.annotation
.ResourceHandlerRegistry
;
import org
.springframework
.web
.servlet
.config
.annotation
.WebMvcConfigurationSupport
;
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry r
){
r
.addResourceHandler("/**")
.addResourceLocations("classpath:/static/")
.addResourceLocations("classpath:/resources/");
super.addResourceHandlers(r
);
}
}
controller页面跳转
@GetMapping("/page")
public String
page(){
return "back/Admin";
}