【笔记】SpringBoot项目配置前端页面

前言

SpringBoot项目配置前端页面

添加依赖

pom.xml
1
2
3
4
5
6
7
8
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

修改配置

1
2
3
4
5
6
7
8
9
10
# 单体架构
spring.thymeleaf.prefix=classpath:/templates/

# 前后端分离架构动态页面
# spring.thymeleaf.prefix=file:/src/main/resources/templates/
# spring.thymeleaf.prefix=file:///src/main/resources/templates/
# spring.thymeleaf.prefix=http://127.0.0.1:8080/

# 前后端分离架构静态页面
# spring.mvc.static-path-pattern=

完成