背景:
导入别人的项目,却报错:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-06 23:35:15.267 ERROR 12944 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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).
Process finished with exit code 1
这是一个常见的问题,如果试了很多都不行,可能是这个原因,以下是没解决前截图:
注意看:
1、 resources
其实只是一个普通的文件夹而已
2、配置文件里, spring.datasource.url
是灰色的,而 spring.datasource.password
却是有颜色的
解决步骤:右击 resources
文件夹,然后选择 Mark Directory as
,然后选择 Resources Root
即可:
修改好之后:
这样就不会报错了!