zoukankan      html  css  js  c++  java
  • Springboot项目启动报错,提示Cannot determine embedded database driver class for database type NONE

    我在springboot项目里面引入了数据库的配置:

            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>1.3.2</version>
            </dependency>
    
    
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>

    然后启动项目的时候报错,提示的错误信息为Cannot determine embedded database driver class for database type NONE

    这是因为spring boot默认会加载org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration类,DataSourceAutoConfiguration类使用了@Configuration注解向spring注入了dataSource bean。因为工程中没有关于dataSource相关的配置信息,当spring创建dataSource bean因缺少相关的信息就会报错。

    修改application.properties配置文件,添加数据库配置信息:

    #jdbc configuration
    spring.datasource.url=jdbc:mysql://127.0.0.1:3306/employees?useUnicode=true&amp;characterEncoding=utf-8
    spring.datasource.username=root
    spring.datasource.password=root
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver

    重新启动Springboot,就可以正常启动了。

  • 相关阅读:
    20191119PHP.class类练习
    20191115PHP cookie登入实例
    Jenkins详细教程
    Navicat 破解
    测试_离职_交接内容
    ETL方法与过程讲
    ETL测试或数据仓库测试入门
    大数据基础了解-(基础01)
    adb调试显示adb: usage: unknown command device
    hive 创建/删除/截断 表(翻译自Hive wiki)
  • 原文地址:https://www.cnblogs.com/modou/p/10030540.html
Copyright © 2011-2022 走看看