本文重在实现理解,过滤器,业务,逻辑需求,样式请无视。。
项目结构如下
1.idea新建Spring boot项目,在pom中加上thymeleaf和mybatis支持。pom.xml代码如下
4.0.0 org.springframework.boot spring-boot-starter-parent2.1.3.RELEASE com.jz table0.0.1-SNAPSHOT table Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-starter-testtest org.springframework.boot spring-boot-starter-thymeleaforg.mybatis.spring.boot mybatis-spring-boot-starter1.3.1 mysql mysql-connector-javaruntime org.springframework.boot spring-boot-maven-plugin
2. 在项目resources目录下新建mybatis文件夹,用于存放mybatis配置文件。 在 application.properties 中配置本地数据源和mybatis配置文件地址, application.properties代码如下
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
spring.datasource.username=用户名
spring.datasource.password=密码
spring.jpa.showSql=true
mybatis:
mybatis.type-aliases-package=com.jz.table.entity
mybatis.mapper-locations=mybatis
a{
text-decoration: none;
color: #333333;
}
#idiv{text-align: center;border-radius: 20px;
width: 300px;
height: 350px;
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;}


