springboot创建项目后运行报错

Posted weimj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot创建项目后运行报错相关的知识,希望对你有一定的参考价值。

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

 

这是因为项目刚创建成功,还没有配置数据源,所以无法指定url

可以再启动类的注解@SpringBootApplication()中加上参数

如下即可:

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
这样就不会报错了!




以上是关于springboot创建项目后运行报错的主要内容,如果未能解决你的问题,请参考以下文章

创建springboot2.1项目运行报错

项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde(代码片段

关于springboot上传文件报错:The temporary upload location ***is not valid

springboot maven项目运行常见报错 及ajax请求报错

springboot_01_手工创建springboot项目

SpringBoot中表单提交报错“Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“(代码片段