Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could

简介: 版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/80897402 ...
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/80897402

刚创建的 Spring Boot 项目,启动后输出:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-03 13:52:44.978 ERROR 6161 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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).

这个错误的原因是因为:

 Spring Boot 虽然做了很多默认的配置,但是它没办法知道你用什么数据库,数据库名称、用户名、密码是什么啊。

打开文件“src/main/resources/application.properties”,配置数据库相关信息:

spring.datasource.url=jdbc:mysql://localhost:3306/databaseName?useUnicode=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true
spring.datasource.username=userName
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

在 1.5版本的时候可以使用:

spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource

在2.0版本却不行了。

感觉改动非常大。

目录
相关文章
|
2月前
|
机器学习/深度学习 前端开发 JavaScript
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
43 0
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
|
1月前
|
Java 数据库连接 Spring
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could
这个错误通常出现在使用Spring Boot进行数据库连接时。错误信息表明Spring Boot未能配置一个DataSource,因为没有指定'url'属性,并且没有发现默认的数据库连接。
31 0
|
1月前
|
Java 数据库
【问题记录(已解决)】springboot整合ssm报错‘url‘ attribute is not specified and no embedded datasource
【问题记录(已解决)】springboot整合ssm报错‘url‘ attribute is not specified and no embedded datasource
|
4月前
|
Java Spring
Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings.
Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings.
269 0
|
6月前
|
应用服务中间件 开发工具 nginx
【git】解决:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
【git】解决:error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
165 0
|
17天前
|
JavaScript
vue截取URL中的参数
vue截取URL中的参数
13 0
|
2月前
|
前端开发
[牛客网-前端大挑战QD2] 获取url参数
[牛客网-前端大挑战QD2] 获取url参数
19 0
|
2月前
BurpSuite8.2 -- 查找包含id参数的URL
BurpSuite8.2 -- 查找包含id参数的URL
19 1
|
2月前
|
分布式计算 DataWorks 关系型数据库
DataWorks数据源问题之参数“连接Url”如何解决
DataWorks数据源是指DataWorks中配置的用于数据集成的外部数据源;本合集将讲解如何在DataWorks中配置和管理数据源,以及处理数据源连接和集成过程中的问题。
29 5
|
3月前
Copy网页中F12里的请求url到postman,并且把所有参数都带过来
Copy网页中F12里的请求url到postman,并且把所有参数都带过来
29 0

热门文章

最新文章