编译器 :Intellij IDEA
数据库:MySql 5.0.67
jpa可以通过实体类生成数据库的表,同时自带很多增删改查方法,大部分sql语句不需要我们自己写,配置完成后直接调用方法即可,很方便。
1,首先新建springboot工程,取名为springbootjpa,设置好java版本后点击next
2,选中三个依赖,lombok,spring Web和Spring Boot DevTools。然后点击finish。
3.添加pom.xml依赖
这里的MySql依赖是根据自己的数据库而定,比如我的版本是5.0.67那么数据库依赖就用的5.1.45这个版本
</dependency> <!-- Spring Data JPA 依赖(重要) --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!-- MySQL 驱动(重要) --> <dependency> &