配置
DRUID连接池
MYSQL数据库
MYBATIS持久层框架
添加依赖
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.30</version></dependency><dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.1.1</version></dependency><dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10</version></dependency> application.propertise文件添加一下配置
#druid数据源配置spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driverspring.datasource.druid.url=jdbc:mysql://localhost:3306/web1?useUnicode=true&characterEncoding=utf-8spring.datasource.druid.username=rootspring.datasource.druid.password=root #连接池参数,初始数、最大数、最小数、获取连接等待超时时间(毫秒)spring.datasource.druid.initial-size=5spring.datasource.druid.max-active=20spring.datasource.druid.min-idle=5spring.datasource.druid.max-wait=60000 #指定mapper*.xml加载位置mybatis.mapper-locations=classpath:mapper/*.xml
原文地址:https://www.cnblogs.com/h-c-g/p/10251791.html
时间: 2024-10-30 22:32:17