需要修改两处文件。

1.pom文件, <!-- 引入 thymeleaf 模板依赖 -->
<dependency> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
2..application.properties文件,新增下面配置。
spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5 spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html spring.thymeleaf.cache=false
3.java代码 如下方式,就可以跳转到html页面
@ControllerAdvice @RequestMapping("index") public class SpringBootController {
@RequestMapping("/index") public String index() { return "ziyong/index"; } }


友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信