一、创建一个springboot项目
二、pom.xml添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
三、application.yml配置PostgreSQL、jpa
server:
port: 28085
spring:
datasource:
driver-class-name: org.postgresql.Driver
username: postgres
password: 123456
url: jdbc:postgresql://192.168.1.247:5432/testPgsql
druid:
filters: stat
max-active: 100
initial-size: 1
max-wait: 60000
min-idle: 1
time-between-eviction-runs