SpringBoot返回静态页面

application.properties中加入如下配置:

#视图映射  
#设置srpingboot使用非严格模式解析模板  
spring.thymeleaf.mode=HTML  
spring.resources.static-locations=classpath:/templates/ 

静态页面放在如下位置:

在java中使用WebMvcConfigurerAdapter返回页面:

参考:https://www.jianshu.com/p/a9e6edd46e98

原文地址:https://www.cnblogs.com/DreamFather/p/11327775.html