org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'utilsServiceImpl': Unsatisfied dependency expressed through field
报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'utilsServiceImpl' : Unsatisfied dependency expressed through field 'utilsMapper' ; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'utilsMapper' defined in file [E:\idea_workspace\KR\handler-integration-server\target\classes\com\hfplm\server\dao\UtilsMapper. class ]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory' ; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration. class ]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' ; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' . Cause: org.apache.ibatis.builder.BuilderException: Error resolving class . Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.hfplm.server.entity.HFERPInterfaceHeader' . Cause: java.lang.ClassNotFoundException: Cannot find class : com.hfplm.server.entity.HFERPInterfaceHeader at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java: 643 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java: 130 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java: 399 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java: 1420 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 593 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 516 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$ 0 (AbstractBeanFactory.java: 324 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 234 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java: 322 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 202 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java: 897 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java: 879 ) ~[spring-context- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java: 551 ) ~[spring-context- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java: 143 ) ~[spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java: 758 ) [spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java: 750 ) [spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java: 405 ) [spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java: 315 ) [spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java: 1237 ) [spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java: 1226 ) [spring-boot- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] at com.hfplm.server.IntegratorApplication.main(IntegratorApplication.java: 19 ) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na: 1.8 .0_281] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 62 ) ~[na: 1.8 .0_281] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43 ) ~[na: 1.8 .0_281] at java.lang.reflect.Method.invoke(Method.java: 498 ) ~[na: 1.8 .0_281] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java: 49 ) [spring-boot-devtools- 2.3 . 5 .RELEASE.jar: 2.3 . 5 .RELEASE] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'utilsMapper' defined in file [E:\idea_workspace\KR\handler-integration-server\target\classes\com\hfplm\server\dao\UtilsMapper. class ]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory' ; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration. class ]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' ; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' . Cause: org.apache.ibatis.builder.BuilderException: Error resolving class . Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.hfplm.server.entity.HFERPInterfaceHeader' . Cause: java.lang.ClassNotFoundException: Cannot find class : com.hfplm.server.entity.HFERPInterfaceHeader at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java: 1524 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java: 1404 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 593 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 516 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$ 0 (AbstractBeanFactory.java: 324 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 234 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java: 322 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 202 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java: 276 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java: 1307 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java: 1227 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java: 640 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] ... 25 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration. class ]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' ; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' . Cause: org.apache.ibatis.builder.BuilderException: Error resolving class . Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.hfplm.server.entity.HFERPInterfaceHeader' . Cause: java.lang.ClassNotFoundException: Cannot find class : com.hfplm.server.entity.HFERPInterfaceHeader at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java: 655 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java: 635 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java: 1336 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java: 1176 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 556 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 516 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$ 0 (AbstractBeanFactory.java: 324 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 234 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java: 322 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 202 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java: 276 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java: 1307 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java: 1227 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java: 1509 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] ... 36 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' ; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\idea_workspace\KR\handler-integration-server\target\classes\mapper\HFERPInterfaceHeaderMapper.xml]' . Cause: org.apache.ibatis.builder.BuilderException: Error resolving class . Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.hfplm.server.entity.HFERPInterfaceHeader' . Cause: java.lang.ClassNotFoundException: Cannot find class : com.hfplm.server.entity.HFERPInterfaceHeader at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java: 185 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java: 650 ) ~[spring-beans- 5.2 . 10 .RELEASE.jar: 5.2 . 10 .RELEASE] ... 49 common frames omitted |
解决办法:Mybatis加载失败。
可能是项目的mapper文件下有.xml文件,但是找到对应的Dao类型
分类:
JAVA / mybatis
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
2021-11-03 JAVA用post请求上传二进制文件