当前位置: 代码迷 >> 综合 >> Exception encountered during context initialization - cancelling refresh attempt:org.springframework
  详细解决方案

Exception encountered during context initialization - cancelling refresh attempt:org.springframework

热度:34   发布时间:2023-10-19 09:50:02.0

我这里是在springboot子模块里发生的错误,如下

Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'dataShowController': Unsatisfied dependency expressed through field 'dataShowService';  nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'dataShowServiceImp': Unsatisfied dependency expressed through field 'dauMapper';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'dauMapper' defined in file 
...Description:Cannot determine embedded database driver class for database type NONEAction:If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

在这里引起的直接原因很简单,就是因为这个子模块声明被莫名奇妙的从父模块pom文件里删除了。可能有的小伙伴在导入一些工程或按错快捷键时会遇到这样的弹框,或者像我一样某明奇妙的掉坑了。
Exception encountered during context initialization - cancelling refresh attempt:org.springframework
然后是一脸问号?我没删这个模块呀,直接No或关闭会话框。然后运行时就出现上面的错误了,同时发现子模块的pom文件颜色变成了下面这个样子:
Exception encountered during context initialization - cancelling refresh attempt:org.springframework
问前辈说是idea的bug,在此直接在父模块pom中手动添加子模块声明。如下:

 <modules>
...<module>dataShowWeb</module>...
</modules>

刷新一下maven工程问题解决。

  相关解决方案