栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Springboot 连接数据库配置

Springboot 连接数据库配置

本文使用druid连接池和mysql作为演示,springboot默认使用HikariCP连接池。

1、引入依赖


            mysql
            mysql-connector-java
            8.0.26
        
        
            log4j
            log4j
            1.2.12
        
        
            com.alibaba
            druid
            1.2.8
        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            2.1.3
        

2、配置application.yml文件

spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/mybatis?serverTimeZone=UTC&useUnicode=true&characterEncoding=UTF-8&useSSL=false
    username: root
    password: zhongxiaoting

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/326246.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号