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";
    }

}

 

posted @ 2023-07-29 20:49  Amy清风  阅读(124)  评论(0编辑  收藏  举报