zoukankan      html  css  js  c++  java
  • boot 项目启动报Cannot datermine embedded database driver class for database type NONE

    部署boot项目时报Cannot datermine embedded database driver class for database type NONE数据库链接什么的也都没有问题,经过百度

    因为spring boot只要你在pom中引入了mybatis-spring-boot-starter 他就会默认需要加载数据库相关的配置

    你要是没有在配置文件中配置数据相关信息,它会加载默认的配置(不存在的) 然后就报错了, 所以你要是要用数据库相关的东西 你就完善配置
    不用数据库相关的东西 就不要在pom中引入相关依赖。

    解决方法:1)应用没有使用到DataSource,但是在pom.xml里引入了spring-boot-starter-jdbc spring-boot-starter-jdbc带入了tomcat-jdbc,它里面有org.apache.tomcat.jdbc.pool.DataSource spring boot里的PooledDataSourceConfiguration,判断classpath下面有DataSource的实现类,尝试去创建DataSource bean 在初始化DataSourceProperties时,尝试通过jdbc的url来探测driver class 因为应用并没有配置url,所以最终在DataSourceProperties.determineDriverClassName()里抛出Cannot determine embedded database driver class for database type NONE,去除pom文件中没有用到的数据库jar

        2)在启动类注解上加上exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class }

        @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })

  • 相关阅读:
    .Net中DataGridview数据如何导出到excel表
    SQLSEVER 中的那些键和约束
    数据仓库中数据粒度
    详解三层架构图
    三层概念总结
    SQL Sever 2008配置工具中过程调用失败解决方法
    设计模式之中介者模式
    设计模式之访问者模式
    设计模式之代理模式
    设计模式之迭代器模式
  • 原文地址:https://www.cnblogs.com/wangjinyu/p/11276553.html
Copyright © 2011-2022 走看看