首页 > 其他分享 >关于druid与springboot版本问题

关于druid与springboot版本问题

时间:2024-02-28 15:33:19浏览次数:25  
标签:springboot sky driver druid datasource 版本 password true

  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

 

标签:springboot,sky,driver,druid,datasource,版本,password,true
From: https://www.cnblogs.com/kun1790051360/p/18040602

相关文章

  • mysql各版本的区别介绍
    摘要:mysql各版本的区别介绍,MySQLCommunityServer是开源免费的,这也是我们通常用的MySQL的版本。essentials”是指精简版,不包含embeddedserverandbenchmarksuite,有自动安装程序和配置向导,没有MySQL文档。“noinstall”是指非安装的压缩包的。现在官方已经不提供windows已......
  • centos7环境用docker-compose部署mysql5.7集群,redis7.2.4,springboot项目
    文件目录结构关于每个配置项及docker-compose的安装,大家可以自己查mysql配置文件master---my.cnf[mysqld]server_id=1gtid-mode=ONenforce-gtid-consistency=1binlog-ignore-db=mysqllog-bin=mysql-binbinlog_cache_size=......
  • 查询postman版本号
    首先打开postman  ......
  • springboot两种配置文件的使用(举例:端口号、虚拟路径配置)
    1、properties配置文件使用   2、yml配置文件、yaml配置文件 在项目中更常用 在项目中一般yml配置文件更为常用,因为yml层级更加明确、清晰,更为关注数据。 ......
  • 如何在SpringBoot中优雅地重试调用第三方API?
    1引言在实际的应用中,我们经常需要调用第三方API来获取数据或执行某些操作。然而,由于网络不稳定、第三方服务异常等原因,API调用可能会失败。为了提高系统的稳定性和可靠性,我们通常会考虑实现重试机制。本文将深入探讨如何在SpringBoot项目中优雅地重试调用第三方API,并结合代码......
  • eclipse自定义jak版本
    安装跟目录下eclipse.ini文件-startupplugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar-vmC:\ProgramFiles\Java\jdk8u392-b08\bin--launcher.libraryplugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.500.v20170531-1133-productorg.eclips......
  • SpringBoot 2x 系列之(七)web场景
    web场景1.SpringMVC自动配置概览SpringBootprovidesauto-configurationforSpringMVCthatworkswellwithmostapplications.(大多场景我们都无需自定义配置)Theauto-configurationaddsthefollowingfeaturesontopofSpring’sdefaults:InclusionofCont......
  • SpringBoot 2x 系列之(五)开发技巧
    开发技巧1.Lombok1.应用场景简化JavaBean的开发帮我们在编译时生成get、set、toString方法2.安装及使用引入依赖【SpringBoot已经做了版本仲裁】<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></depende......
  • SpringBoot 2x 系列之(四)自动配置
    自动配置1.引导加载自动配置类见SpringBoot1.md一、SpringBoot入门4.2主程序类,主入口类【自动配置原理】1.1@SpringBootConfiguration见SpringBoot1.md一、SpringBoot入门4.2主程序类,主入口类【自动配置原理】[email protected]@AutoConfi......
  • SpringBoot 2x 系列之(三)容器功能
    容器功能1.组件添加1.1@Configuration结合@Bean注册组件@Configuration见[email protected]@Component、@Controller、@Service、@Repository见Spring.md相关内容1.3@ComponentScan见[email protected]@Import见Spring.md8.......