1、数据库连接
# Mysql 8.x以上驱动使用:com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/dm?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
spring.datasource.data-username=root
spring.datasource.data-password=123456
# 以下配置HikariCP连接池,需要对应的依赖
# 配置HikariPC
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.pool-name=MyHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
2、MyBatis
不加classpath默认扫描包下同级目录,比如mybatis.mapper-locations=/com/linke/mapper/*.xml
相当于com.linke.dao同级的com.linke.mapper
# 配置resource下mybatis的xml扫描
mybatis.mapper-locations=classpath:/mapper/*.xml








网友评论