Cannot determine embedded database driver class for database type NONE

 SpringBoot程序启动时出现错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Cannot determine embedded database driver class for database type NONE

Action:

If you want an embedded database please put a supported one on the classpath. If
 you have database settings to be loaded from a particular profile you may need 
to active it (no profiles are currently active).

解决方法:

①在主启动类中排除数据源的自动配置依赖  

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})

②将pom文件中的mybatis依赖去掉

	<!-- 
        <dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
       </dependency>
     -->

③在application.yml文件(或application.xml 

【将下面的yml格式转换成xml格式即可 在线转换器:https://www.toyaml.com/index.html】)

中添加数据源的相关配置

spring:
  application:
    name: study-cloud-test
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource 
    driver-class-name: org.gjt.mm.mysql.Driver  
    url: jdbc:mysql://localhost:3306/cloudDB
    username: root
    password: 123456
    
    dbcp2:
      min-idle: 5   # 数据库连接池的最小维持连接数
      initial-size: 5  #初始化连接数
      max-total: 5    #最大连接数
      max-wait-millis: 200  # 等待连接获取的最大超时时间
      

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值