springboot访问页面
结构
1.引入依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
2.在yml文件配置
spring: thymeleaf: mode: HTML encoding: UTF-8 prefix: classpath:/templates/ suffix: .html
3.Controller
@Controller public class IndexController { @GetMapping("/") public String index(){ return "login"; } }