1,导入starter
1.1,或者直接在pom中导入相关依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
2,编写application.yml配置文件(数据test已经存在)
spring:
datasource:
username: root
password: 123456
url: jdbc:mysql://192.168.84.128:3309/test
driverClassName: com.mysql.cj.jdbc.Driver
如果需要也可以在application.yml中进行jpa的相关配置:</