Postgresql 与 Spring的集成

pom.xml 中引入稳定Jar 
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>

bootatrap.yml 文件中进行相关配置

datasource:
driver-class-name: org.postgresql.Driver #驱动类名
hikari:
auto-commit: true
connection-test-query: SELECT 1
connection-timeout: 30000
idle-timeout: 30000
max-lifetime: 1800000
maximum-pool-size: 15
minimum-idle: 5
pool-name: DatebookHikariCP
password: ZZxx@1q2w3e4r
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=false&useTimezone=true&serverTimezone=UTC&serverTimezone=Asia/Shanghai&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull
username: postgres
原文地址:https://www.cnblogs.com/jabez1992/p/14200635.html