springboot整合postgresql_springboot 整合druid,使用postgresql

发布于:2023-07-27 ⋅ 阅读:(74) ⋅ 点赞:(0)

1.首先引入相关依赖

com.alibaba

druid-spring-boot-starter

1.1.10

org.postgresql

postgresql

runtime

org.springframework.boot

spring-boot-starter-jdbc

2.配置yml

spring:

datasource:

druid:

driver-class-name: org.postgresql.Driver

url: jdbc:postgresql://ip:port/**?&ssl=false

username: postgres

password: 123456

initial-size: 1

max-active: 128

min-idle: 96

filter:

stat:

log-slow-sql: true

db-type: postgresql

enabled: true

3.配置类

@Slf4j

@Configuration

public class DruidConfig {

@ConfigurationProperties(prefix = "spring.datasource.druid")

@Bean(destroyMethod = "close", initMethod = "init") //第一次使用,页面会出现(*) property for user to setup


网站公告

今日签到

点亮在社区的每一天
去签到