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).
错误描述:在.xml文件中加入了mysql,jdbc但是没有设置数据库的url就会出现此类错误导致程序停止运行
![](https://i-blog.csdnimg.cn/blog_migrate/bb6c5aae24adef47a845a32a73de8b60.png)
解决方法:
方法一:
![](https://i-blog.csdnimg.cn/blog_migrate/b4c7c2b4b98d7b7a0ed986a17621ed74.png)
将jdbc和mysql依赖注释掉,一定要刷新在运行
![](https://i-blog.csdnimg.cn/blog_migrate/6318eab73195a52bd8981affa04e8307.png)
错误已解决
方法二:
![](https://i-blog.csdnimg.cn/blog_migrate/b09cbac6ed09a52214bf0f275cbfe69d.png)
在主程序上将@SpringBootApplication 改成 @SpringBootApplicaiton(exclude = {DataSourceAutoConfiguration.class})即可