Spring boot项目 idea工具

创建项目初始

一定要使用jar创建才能启动项目

如何配置springboot跳转html页面

1.首先在pom文件中引入模板引擎jar包,即:

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

2.在application.properties中配置模板引擎

spring.thymeleaf.prefix=classpath:/templates/

必须添加否则访问不了

注意:@controller不是@RestController,使用@RestController会返回“index”字符串

原文地址:https://www.cnblogs.com/huoxiansudi/p/11256231.html