1. 引入jar包(pgsql)
org.postgresql
postgresql
42.2.5.jre7
2. 写好配置
pgsql:
datasource:
url: jdbc:postgresql://IP:端口/库名
username: 用户名
password: 密码
driver-class-name: org.postgresql.Driver
maxActive: 50
initialSize: 10
maxWait: 60000
minIdle: 6
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
3. 写配置类(以前的结合方式,还没有springboot和pgsql直接整合不用写配置类的包)
在resources下创建pgmapper文件夹,放置sql文件
@Configuration
@MapperScan(basePackages = PgsqlDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "pgSqlSessionFactory")
public class PgsqlDataSourceConf