第一步:src/main/resource/templates路径下新建需要返回的html文件

第二步:pom.xml添加thymeleaf依赖

<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

第三步:application.xml配置

spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.mode=HTML5

第四步:controller写入口

第五步:浏览器访问


版权声明:本文为qq_36880602原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_36880602/article/details/115828106