Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 映射器类的UnsatifiedPendencyException_Spring_Jhipster_Mapper - Fatal编程技术网

Spring 映射器类的UnsatifiedPendencyException

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表示的未满足的依赖关系;嵌套异常为

我已经创建了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。依赖项批注:{}


你能帮我吗?

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命令自动生成映射器和控制器