Spring Boot app: Failed to determine a suitable driver class

avatar
作者
筋斗云
阅读量:0

目录

问题描述

我尝试连接springboot;当我运行时,出现错误“Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured."”

application.yml 应用程序.yml

datasource:     druid:       driver-class-name: com.mysql.cj.jdbc.driver       url: jdbc:mysql://localhost:3306/dbName       username: root       password: ********(pass) 

Output 输出

*************************** APPLICATION FAILED TO START ***************************  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). 

解决方案

删除application.yml中的druid

datasource:       driver-class-name: com.mysql.cj.jdbc.driver       url: jdbc:mysql://localhost:3306/dbName       username: root       password: ********(pass) 

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!