Spring 映射器类的UnsatifiedPendencyException
我已经创建了jhipster应用程序。启动应用程序时,出现以下错误: org.springframework.beans.factory.unsatifiedDependencyException:创建名为“categoryServiceImpl”的bean时出错,该bean在文件[/server_2/target/classes/com/test/test/service/impl/categoryServiceImpl.class]中定义:通过构造函数参数1表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.NoSuchBeanDefinitionException:没有“com.test.test.service.mapper.CategoryMapper”类型的合格bean可用:至少需要1个符合autowire候选条件的bean。依赖项批注:{}Spring 映射器类的UnsatifiedPendencyException,spring,jhipster,mapper,Spring,Jhipster,Mapper,我已经创建了jhipster应用程序。启动应用程序时,出现以下错误: org.springframework.beans.factory.unsatifiedDependencyException:创建名为“categoryServiceImpl”的bean时出错,该bean在文件[/server_2/target/classes/com/test/test/service/impl/categoryServiceImpl.class]中定义:通过构造函数参数1表示的未满足的依赖关系;嵌套异常为
你能帮我吗?
CategoryMapperImpl
是由mapstruct注释处理器在构建时从JHipster导入JDL文件时生成的CategoryMapper
接口生成的,请确保在启动应用程序之前运行mvnw
或gradlew
生成它
请参阅关于使用DTO的官方文档:原因:org.springframework.beans.factory.NoSuchBeanDefinitionException:没有类型为“com.test.test.service.mapper.CategoryMapper”的合格bean可用:至少需要1个符合autowire候选条件的bean。依赖项注释:{}例外情况是spring无法找到类型为
com.test.test.service.mapper.CategoryMapper
的bean;这可能有几个原因;例如,spring没有扫描正确的包,因此找不到com.test.test.service.mapper.CategoryMapper
,也不可能注入它。错误有点明显。您有您的categoryServiceImpl
对象,该对象正在从categoryServiceImpl
实例化,它采用类型为CategoryMapper
的构造函数参数,但您没有。但我的代码是由jhipsterentity、service、,jhipster通过jhipster import JDL./src/model/model.JDL命令自动生成映射器和控制器