datasource:
druid:
driver-class-name: ${sky.datasource.driver-class-name}
url: jdbc:mysql://${sky.datasource.host}:${sky.datasource.port}/${sky.datasource.database}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: ${sky.datasource.username}
password: ${sky.datasource.password}

上述是黑马程序员苍穹外卖的yml里的druid配置,我复制在另一个项目的时候报错

Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Process finished with exit code 1
后来发现是因为我新的项目用的是springboot3,而这个老项目用的2,很多人都说降版本可以解决,当然也可以改成下面:将druid放在type里

  datasource:
driver-class-name: ${datasource.driver-class-name}
url: jdbc:mysql://${datasource.host}:${datasource.port}/${datasource.database}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: ${datasource.username}
password: ${datasource.password}
type: com.alibaba.druid.pool.DruidDataSource

关于druid与springboot版本问题的更多相关文章

  1. alibaba druid 在springboot start autoconfig 下的bug

    alibaba druid 在springboot start autoconfig下的bug 标签(空格分隔):druid springboot start autoconfig 背景 发现.分析过 ...

  2. SpringCloud 与 SpringBoot版本问题

    如果SpringBoot版本与SpringCloud版本不一致,SpringBoot应用启动会报错: 解决方案: 版本对应关系可以在 https://start.spring.io/info 上查看: ...

  3. Spring Cloud Alibaba (一): SpringCloud与SpringBoot版本选型

    前言   近年SpringCloud与SpringBoot更新迭代非常频繁,导致我们对两者的版本选型非常的困难.若是版本选择有问题, 会导致开发中调试兼容性占用非常多的得必要时间. SpringClo ...

  4. 升级了Springboot版本后项目启动不了了

    问题背景 项目上使用的springboot版本是2.1.1.RELEASE,现在因为要接入elasticsearch7.x版本,参考官方文档要求,需要将springboot版本升级到2.5.14. 本 ...

  5. session共享问题、springboot 版本不统一问题

    问题:按照正常的程序将session 共享引入工程,但是一直取不到 原因:springboot 的版本不同导致,存session的springboot 用的是springboot1.5.6,而取ses ...

  6. 【SpringBoot | Druid】SpringBoot整合Druid

    SpringBoot整合Druid Druid是个十分强大的后端管理工具,具体的功能和用途请问阿里爸爸 1. 在pom.xml中导入包 <!-- alibaba 的druid数据库连接池 --& ...

  7. 使用Druid作为SpringBoot项目数据源(添加监控)

    Druid是一个关系型数据库连接池,它是阿里巴巴的一个开源项目.Druid支持所有JDBC兼容数据库,包括了Oracle.MySQL.PostgreSQL.SQL Server.H2等.Druid在监 ...

  8. 微信扫码支付springboot版本

    发布时间:2018-11-06   技术:springboot+freemarker   概述 该项目是一个采用springboot构建的web项目,主要实现了微信扫码支付功能.包含最基本的创建订单, ...

  9. Springboot 版本+ jdk 版本 + Maven 版本的匹配

    Spring boot 版本 Spring Framework jdk 版本 maven 版本 1.2.0 版本之前 6 3.0 1.2.0 4.1.3+ 6 3.2+ 1.2.1 4.1.3+ 7 ...

  10. Springboot 版本+ jdk 版本 + Maven 版本的对应关系

    Spring boot 版本 Spring Framework jdk 版本 maven 版本 1.2.0 版本之前   6 3.0 1.2.0 4.1.3+ 6 3.2+ 1.2.1 4.1.3+ ...

随机推荐

  1. mysql存储地理信息的方法

    MySQL 存储地理信息通常使用 GEOMETRY 数据类型或其子类型(如 POINT, LINESTRING, POLYGON 等).为了支持这些数据类型,MySQL 提供了 SPATIAL 索引, ...

  2. 『手撕Vue-CLI』拉取版本号

    开篇 在上一篇文章中,给 nue-cli 添加了与用户终端交互的功能,这一次来实现一个拉取版本号的功能. 这个功能的背景是,有时候我们在使用脚手架的时候,不同版本的脚手架可能会有不同的功能,所以用户有 ...

  3. ETL工具-nifi干货系列 第五讲 处理器GenerateFlowFile

    1.今天我们一起来学习处理器GenerateFlowFile.这个处理器创建带有随机数据或自定义内容的 FlowFiles.GenerateFlowFile 对于负载测试.配置和模拟非常有用.从工具栏 ...

  4. ABC330

    D 记录每一行,每一列有多少个 o,然后统计答案即可. code E 想到 \(mex^{i \le n}_{i = 1} a_i \le n\) 这整个题就可做了(赛时因为没想到这个,痛失 \(47 ...

  5. vue饼图

    结果图 原型 1 <template> 2 <!-- 左右柱状图 --> 3 <div ref="rankEcharts" :style=" ...

  6. #PowerBi 1分钟学会,用PowerBi获取数据库最近90天的数据(DATE_SUB)

    在powerbi报表中,我们往往会对数据源进行日常刷新,powerbi链接了数据库的情况下,根据日期灵活取数是我们必须掌握的一个技能. 在本文中,我们将介绍如何使用 SQL 的 DATE_SUB 函数 ...

  7. openEuler 20.04 TLS3 上的 Python3.11.9 源码一键构建安装

    #! /bin/bash # filename: python-instaler.sh SOURCE_PATH=/usr/local/source # 下载源码包 mkdir -p $SOURCE_P ...

  8. Numpy技巧: 由label获得相等矩阵

    Numpy技巧: 由label获得相等矩阵     假设Label为:  [ABAC] , 如何方便的得到一个矩阵, 其元素i,j表示第i位和第j位相等呢?   先把Label复制扩展成: m,m 的 ...

  9. windows中运行nicegui官网内容

    内容受到bilibili视频nicegui官网访问不了?教你本地部署文档,我写python终于有界面启发,其余部分由chatgpt协助生成. 1. 在本地新建目录如 nicegui_web 2. 从g ...

  10. SSM中Mybatis的配置

    注:数据库连接(此过程不当做本次笔记重点,只做简单概述) 1.创建并配置jdbc.properties文件 2.通过Druid连接池配置连接数据库 3.将数据源(dataSource)注入IOC 详细 ...