数据库
首页 > 数据库> > SpringBoot:JPA整合PostgreSQL

SpringBoot:JPA整合PostgreSQL

作者:互联网

1.引入jar包

 <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
 </dependency>

2、写配置文件(application.propertise)
*我们没有声明任何模式名字就创建了表。缺省时,这样的表(以及其它对象)都自动放到一个叫做"public"的模式中去了,所以 spring.datasource.hikari.jdbc-url中的currentSchema=public


spring.application.name=x3-service-load
x3.base.service-name=load
x3.base.tag=load

server.port=8099

useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.hikari.driver-class-name=org.postgresql.Driver
spring.datasource.hikari.jdbc-url=jdbc:postgresql://127.0.0.1:5432/test?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&currentSchema=public

spring.datasource.hikari.username=XXX
spring.datasource.hikari.password=XXX

spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=35
spring.datasource.hikari.idle-timeout=180000
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.time-between-eviction-runs-millis=18800
spring.datasource.hikari.connection-timeout=30000


logging.level.com.x3 = debug
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.database=postgresql
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8

标签:PostgreSQL,SpringBoot,JPA,spring,jpa,hikari,datasource,postgresql,true
来源: https://blog.csdn.net/qq_38801308/article/details/99319884