情景

一个Maven单模块项目改造为多模块项目后,发现报错:

***************************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

一种可行的解决方案

如果是Maven多模块项目,查看IDEA右上角Edit Configurations -> Use classpath of module,此栏应为 包含程序入口的xxxApplication.javaapplication.yml的module:

如上图,博主的程序入口xxxApplication.javaapplication.yml放置于server这个module,brother-takeaway-order是之前单体模块的名称。把此处的module切换为server,即可解决报错。