解决:UnsatisfiedDependencyException 异常

文章描述了一个在Spring框架中遇到的UnsatisfiedDependencyException问题,该问题源于dao接口对应的bean无法创建,进而影响了service和controller层的依赖注入。错误的根本在于缺少了特定jar包中的某个包。解决方案包括检查controller、service、dao层的注解使用、接口实现、XML映射文件的正确性,以及排查重复的Mapper.xml文件和接口名称。

问题描述:
重点报错信息:

Specified class is an interface
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'smsUnvsBean' :Unsatisfied dependency expressed through field 'freemarkService'

原因分析:
大致原因:dao接口无法创建bean,导致service层依赖无法注入,导致controller层依赖无法注入

归根结底:又一个bean创建失败

查找maven包里面地址com.ccb.unvs.下面没有design这个包,证明是jar包的问题,引入jar包解决

汇总了许多网上的办法:

controller层service层dao层注解是否都使用正确?
接口有没有写实现类,实现类实现的接口是否正确?
xml映射文件里路径大小写类型是否正确?
有重复命名的xxxMapper.xml文件吗?
接口名字是否重复?
 

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ODataConnectorImpl': Unsatisfied dependency expressed through field 'messages'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'weibaobiaoMessages': Unsatisfied dependency expressed through field 'securityService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'amsSecurityService': Unsatisfied dependency expressed through field 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [security-service.xml]: Cannot resolve reference to bean 'amsAuthorizationRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'amsAuthorizationRealm': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'customerService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customerServiceImpl': Unsatisfied dependency expressed through field 'metadataService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'defaultMetadataServiceImpl': Unsatisfied dependency expressed through field 'zxtbTask'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zxtbTask': Unsatisfied dependency expressed through field 'redisDistributeLock'; nested exception is org.springframework.beans.f
07-09
分析报错:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisSubscribeListener': Unsatisfied dependency expressed through field 'alarmListener'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmListener': Unsatisfied dependency expressed through field 'alarmTask'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmTask': Unsatisfied dependency expressed through field 'alarmReceiver'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmReceiver': Unsatisfied dependency expressed through field 'eventAlarmLogInsertTask'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventAlarmLogInsertTask': Unsatisfied dependency expressed through field 'eventLogAlarmService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventLogAlarmService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventLogAlarmMapper' defined in URL [jar:file:/opt/evo/evo-common/evo-event/evo-event.jar!/com/dahua/evo/event/business/mapper1/EventLogAlarmMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardingDataSource' defined in class path resource [com/dahua/evo/event/config/DataSourceConfig1.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingDataSource' threw exception; nested exception is
08-15
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plmWfStartProcessService': Unsatisfied dependency expressed through field 'formDataService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plmWfFlowFormDataService': Unsatisfied dependency expressed through field 'taskReviewService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plmWfTaskReviewService': Unsatisfied dependency expressed through field 'taskFormDraftService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plmWfTaskFormDraftService': Unsatisfied dependency expressed through field 'attachmentService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plmWfAttachmentService': Unsatisfied dependency expressed through field 'attachmentHandlers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plmWfAttachmentHandlerImpl': Unsatisfied dependency expressed through field 'addressService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'plmWfAddressService' defined in URL [jar:file:/jalor6/lib/NameplateService-1.0.0.jar!/BOOT-INF/lib/plm-attachment-check-adapter-huawei-1.26.8-RELEASE.jar!/com/huawei/it/plm/attachmentcheck/service/impl/AddressService.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.huawei.it.plm.attachmentcheck.service.impl.AddressService] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@1cc9cfb2]
最新发布
12-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值