springboot + mybatis + pagehelper + druid + mysql

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/zhangziyangtest?serverTimezone=Asia/Shanghai&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root

The number of connections in the connection pool size initialization druid, minimum, maximum

spring.datasource.druid.initialSize=5
spring.datasource.druid.minIdle=5
spring.datasource.druid.maxActive=20

Configuring acquisition time connection wait timeout

spring.datasource.druid.maxWait=60000

Intervals the frequency of such detection, an idle connection is detected to be closed in milliseconds

spring.datasource.druid.timeBetweenEvictionRunsMillis=60000

A connector disposed in the survival time of the minimum pool milliseconds

spring.datasource.druid.minEvictableIdleTimeMillis=300000
spring.datasource.druid.validationQuery=SELECT 1 FROM DUAL
spring.datasource.druid.testWhileIdle=true
spring.datasource.druid.testOnBorrow=false
spring.datasource.druid.testOnReturn=false

Whether the cache preparedStatement, which is under PSCache official suggested MySQL advised to turn off personal advice is recommended if you want to open SQL firewall

spring.datasource.druid.poolPreparedStatements=true
spring.datasource.druid.maxPoolPreparedStatementPerConnectionSize=20

Configuring filters monitor statistics interception, remove the monitoring interface sql not statistics, 'wall' for firewall

spring.datasource.druid.filters=stat,wall,log4j

To open mergeSql function by connectProperties property; slow SQL record

spring.datasource.druid.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000

! ! ! Do not configure timeBetweenLogStatsMillis regularly log output and lead to the statistics of sql cleared

spring.datasource.druid.timeBetweenLogStatsMillis=20000

MyBatis DAO position + Bean position
mybatis.mapper-locations CLASSPATH =: / Mapper /
.xml

mybatis.type-aliases-package=com.springboot.demo.bean

Pagination plug-in configuration pagehelper

pagehelper.page-size-zero=true
pagehelper.offset-as-page-num=true
pagehelper.row-bounds-with-count=true
pagehelper.reasonable=true
pagehelper.params=pageNum=pageHelperStart;pageSize=pageHelperRows;
pagehelper.support-methods-arguments=false
pagehelper.helper-dialect=mysql

Guess you like

Origin www.cnblogs.com/ZhangZiYangDeBoKe/p/11281694.html