目录
- 问题描述
- 解决方案
问题描述
我尝试连接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)