springboot踩坑记录
之前运行好端端的项目,今天下午打开只是添加了一个文件之后 再运行都报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).这个错误意思是说我配置数据库的问题,但是很明显如果是配置问题就不会踩坑一直头疼一下午了,报这个错的人也都不会上这儿来。
最根本的问题是没有加载我们的application文件,当时看了很多解决办法,有让在application.yml中设置不启用默认配置的,有让在pom文件中添加什么依赖的,还有让在main方法添加注释的,该试的都试了,甚至把我本来添加的文件删除掉,恢复到下午打开的状态去运行依旧报这个错误,最后我解决的办法是在一个评论区看到的,出现这个问题先别急着去修改你的项目,你就试试把这个项目clean掉,即把target删掉,之后再重新package一遍,再运行,看看问题会不会解决,我按照这个方法已解决,总结就是idea发神经