1.创建项目 选择基本的骨架(thymeleaf,spring-web)
2.项目基本文件列表:
3. 更改application.properties为.yml文件配置并配置端口号 ,关闭cache缓存
#端口号8080
server:
port: 8080
# 关闭缓存
spring:
thymeleaf:
cache: false
4.在idea中配置 thymeleaf 模板
模板代码如下:
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Index Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
</body>
</html>
5. 新建UserVO实体类基本数据
@Data
public class UserVO {
private String userName;
private int age;
private Date createTime;
private char sex;
private boolean boolVip;
private List<String> classesList;
}
6. 新建controller层一个类UserController
@Controller
public class UserController {