初步搭建springboot应用,报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedd

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

翻译就是:无法配置DataSource:未指定'url'属性,也无法配置嵌入数据源。

 

很明显,就是你在应用中没有配置datasource的一些相关属性,例如:地址值啊,数据库驱动啊,用户名啊,密码啊,

 

 

都知道,SpringBoot的最大一个好处就是自动配置:所以我们只是需要给他配置文件的值,它就会自动配置。配置在application.properties文件中

那么我将把SpringBoot的一些最基本的配置信息给大家站出来

 

 

 

当然,也可以不配置,但是你需要声明一下

启动类头部声明就可以了:

@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
posted @ 2021-02-21 17:42  舞步林云  阅读(333)  评论(0编辑  收藏  举报