Failed to configure a DataSource 'url' attribute问题解决

Posted zilongmao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Failed to configure a DataSource 'url' attribute问题解决相关的知识,希望对你有一定的参考价值。

才写了一行代码又报错了..


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

Disconnected from the target VM, address: ‘127.0.0.1:58792‘, transport: ‘socket‘

Process finished with exit code 0

未指定“url”属性,无法配置嵌入的数据源。

原因:由于添加了数据库组件,所以autoconfig会去读取数据源配置,新建的项目还没有配置数据源,所以会导致异常出现。

解决办法:
在启动类添加如下内容
即:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
----------------
转自:悟世君子的博客





以上是关于Failed to configure a DataSource 'url' attribute问题解决的主要内容,如果未能解决你的问题,请参考以下文章

struts报错严重: Dispatcher initialization failed Unable to load configuration.

Failed to upgrade Oracle Cluster Registry configuration(root.sh)

安装Intel HAXM:"failed to configure driver unknown error. failed to open driver"

Failed to configure a DataSource 'url' attribute问题解决

springboot启动报错:Failed to configure a DataSource

Springboot Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded