情景
一个 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.java
和application.yml
的 module:
如上图,博主的程序入口 xxxApplication.java
和application.yml
放置于 server
这个 module,brother-takeaway-order
是之前单体模块的名称。把此处的 module 切换为server
,即可解决报错。