# SpringBoot7_7_6
**Repository Path**: xgkp/SpringBoot7_7_6
## Basic Information
- **Project Name**: SpringBoot7_7_6
- **Description**: 数据回滚测试
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2022-03-22
- **Last Updated**: 2022-03-22
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# SpringBoot7_7_6
#### 介绍
数据回滚测试
#### 软件架构
SpringBoot-Data
JPA
MySQL
#### JPA和MySQL和单元测试junit的依赖
```
mysql
mysql-connector-java
runtime
org.springframework.boot
spring-boot-starter-data-jpa
junit
junit
test
```
#### Applicaiton.properities中关于Mysql的一点配置
```
spring.datasource.url=jdbc:mysql://127.0.0.1/book?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
spring.datasource.username=root
spring.datasource.password=rootroot
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql= true
spring.thymeleaf.cache=false
server.port=8080
```
#### 在IDEA中JPA的实体创建方式
New-JPA-Entity-[Card]
Name:类名字
EntityType:Entity
Id:int
Idgeneration:Identity
Select OK
#### 在IDEA中快速创建Responsitory
New-SpringData-Respository
Entity:上一步创建的[Card]
inputName
#### 其他说明:
@Transactional:数据回滚的意思。所有方法执行完了以后,回滚成原来的样子。在实际的测试代码中,如果将改注解注释掉,数据是不会回滚的。
Assert.assertThat过期了,需要用到MatcherAssert.assertThat