1. 程式人生 > >SPRINGBOOT配置MYSQL,MYBATIS,DRUID

SPRINGBOOT配置MYSQL,MYBATIS,DRUID

1.3 添加 oot cto wait 框架 mysql- mybatis character

配置

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.Driver
spring.datasource.druid.url=jdbc:mysql://localhost:3306/web1?useUnicode=true&characterEncoding=utf-8
spring.datasource.druid.username=root
spring.datasource.druid.password=root

#連接池參數,初始數、最大數、最小數、獲取連接等待超時時間(毫秒)
spring.datasource.druid.initial-size=5
spring.datasource.druid.max-active=20
spring.datasource.druid.min-idle=5
spring.datasource.druid.max-wait=60000

#指定mapper*.xml加載位置
mybatis.mapper-locations=classpath:mapper/*.xml

SPRINGBOOT配置MYSQL,MYBATIS,DRUID