SpringBoot 启动报错 Unsatisfied dependency expressed through field 'coreService'

本文详细解析了使用Feign进行系统间调用时出现的UnsatisfiedDependencyExpressedThroughField错误,提供了具体的实现类代码示例,并指导如何通过mvn命令解决依赖问题。

今天帮别人解决一个问题,因为使用的feign进行系统间调用出现了Unsatisfied dependency expressed through field 'coreService'  的问题

远程调用的接口

@FeignClient(name = "coreserver" )
public interface CoreService {

    @RequestMapping(value = "v1/internal/address/{chain}", method = RequestMethod.POST)
    public ResultData addAddress(@PathVariable String chain,  @RequestBody String json);

    @RequestMapping(value = "v1/internal/monitor/{chain}", method = RequestMethod.POST)
    public ResultData subscribeAddress(@PathVariable String chain, @RequestBody String json);

    @RequestMapping(value = "v1/internal/monitor/{chain}", method = RequestMethod.DELETE)
    public ResultData unSubscribeAddress(@PathVariable String chain, @RequestBody String json);

    @RequestMapping(value = "v1/internal/records/{chain}" ,method = RequestMethod.GET)
    public ResultData queryRecord(@PathVariable String chain,@RequestParam String uuid,@RequestParam String platform);

    @RequestMapping(value = "v1/internal/transaction/{chain}" ,method = RequestMethod.POST)
    public ResultData transactionRecord(@PathVariable String chain, @RequestBody String json);

    @RequestMapping(value = "v1/internal/address/WithdrawMoney" ,method = RequestMethod.POST)
    public ResultData withdrawMoney( @RequestBody String json);

    @RequestMapping(value = "/v1/internal/address/notionalpooling" ,method = RequestMethod.POST)
    public ResultData notionalpooling( @RequestBody String json);

}

调用的实现类

@Component
public class CoreRemoteFallback implements FallbackFactory<CoreService> {

    @Override
    public CoreService create(Throwable throwable) {
        return new CoreService() {
            @Override
            public ResultData addAddress(String chain, String json) {
                // TODO: 2018/12/21 创建地址调用失败处理
                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }

            @Override
            public ResultData subscribeAddress(String chain, String json){
                // TODO: 2018/12/21 订阅失败处理
                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }
            @Override
            public ResultData unSubscribeAddress(String chain, String json){
                // TODO: 2018/12/21 取消订阅调用失败处理
                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }

            @Override
            public ResultData queryRecord(String chain,  String uuid,  String platform) {
                // TODO: 2018/12/21 查询转账信息失败处理
                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }

            @Override
            public ResultData transactionRecord(String chain, String json) {
                // TODO: 2018/12/29 转账条用失败回调处理

                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }

            @Override
            public ResultData withdrawMoney( String json){
                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }

            @Override
            public ResultData notionalpooling(  String json){
                return new ResultData(ReStatusEnum.OPERNATE_FIAL.getId(),ReStatusEnum.OPERNATE_FIAL.getName(),null);
            }

        };
    }
}

找不到CoreService的实例,无法注入导致的报错,

另外就是需要将依赖的自己的项目install到本地

需要mvn compile编译java代码然后在动心启动   compile的时候会download

这种问题的排查,启动不了,先compile或者package一下将问题暴露出来

 

 

 

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdWorkHourServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'psmPjtServiceImpl': Unsatisfied dependency expressed through field 'plnMilstnService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plnMilStnServiceImpl': Unsatisfied dependency expressed through field 'psmPjtmilstnService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'psmPjtmilstnServiceImpl': Unsatisfied dependency expressed through field 'objectTypeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'objectTypeServiceImpl': Unsatisfied dependency expressed through field 'lcTranService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcTranServiceImpl': Unsatisfied dependency expressed through field 'lclcPhaseService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcLcPhaseServiceImpl': Unsatisfied dependency expressed through field 'lcLcService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcLcServiceImpl': Unsatisfied dependency expressed through field 'wfWorkflowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfWorkflowServiceImpl': Unsatisfied dependency expressed through field 'sysViewInfoService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysViewInfoService': Unsatisfied dependency expressed through field 'wfFieldService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfFieldServiceImpl': Unsatisfied dependency expressed through field 'pageFieldService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfPageFieldServiceImpl': Unsatisfied dependency expressed through field 'wfPageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfPageServiceImpl': Unsatisfied dependency expressed through field 'wfTabService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfTabServiceImpl': Unsatisfied dependency expressed through field 'nodeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfNodeServiceImpl': Unsatisfied dependency expressed through field 'wfTransitionService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfTransitionServiceImpl': Unsatisfied dependency expressed through field 'viewComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'viewComponentImpl': Unsatisfied dependency expressed through field 'valueConverComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dyValueConverComponentImpl': Unsatisfied dependency expressed through field 'objOprefService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'objOprefServiceImpl': Unsatisfied dependency expressed through field 'actionHandler'; nested exceptio n is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'actionHandlerImpl': Unsatisfied dependency expressed through field 'entityExportComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityExportComponentImpl': Unsatisfied dependency expressed through field 'versionsPlanComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dyVersionsPlanComponentImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'taskHandlerImpl': Bean with name 'taskHandlerImpl' has been injected into other beans [actionController,bizCommServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesForType' with the 'allowEagerInit' flag turned off, for example. 08:13:29.749 INFO [main] com.alibaba.druid.pool.DruidDataSource : {dataSource-0} closing ... 08:13:30.616 WARN [AsyncReporter{org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender@6842c101}] o.s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaRibbonClientConfiguration': Unsatisfied dependency expressed through field 'clientConfig'; nested exception is org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaClientConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!) 08:13:30.621 INFO [main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 08:13:30.802 INFO [main] o.s.b.a.l.ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 08:13:30.823 ERROR [main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdWorkHourServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'psmPjtServiceImpl': Unsatisfied dependency expressed through field 'plnMilstnService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plnMilStnServiceImpl': Unsatisfied dependency expressed through field 'psmPjtmilstnService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'psmPjtmilstnServiceImpl': Unsatisfied dependency expressed through field 'objectTypeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'objectTypeServiceImpl': Unsatisfied dependency expressed through field 'lcTranService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcTranServiceImpl': Unsatisfied dependency expressed through field 'lclcPhaseService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcLcPhaseServiceImpl': Unsatisfied dependency expressed through field 'lcLcService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'lcLcServiceImpl': Unsatisfied dependency expressed through field 'wfWorkflowService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfWorkflowServiceImpl': Unsatisfied dependency expressed through field 'sysViewInfoService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sysViewInfoService': Unsatisfied dependency expressed through field 'wfFieldService'; nested exc eption is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfFieldServiceImpl': Unsatisfied dependency expressed through field 'pageFieldService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfPageFieldServiceImpl': Unsatisfied dependency expressed through field 'wfPageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfPageServiceImpl': Unsatisfied dependency expressed through field 'wfTabService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfTabServiceImpl': Unsatisfied dependency expressed through field 'nodeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfNodeServiceImpl': Unsatisfied dependency expressed through field 'wfTransitionService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wfTransitionServiceImpl': Unsatisfied dependency expressed through field 'viewComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'viewComponentImpl': Unsatisfied dependency expressed through field 'valueConverComponent'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dyValueConverComponentImpl': Unsatisfied dependency expressed through field 'objOprefService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'objOprefServiceImpl': Unsatisfied dependency expressed through field 'actionHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'actionHandlerImpl': Unsatisfied dependency expressed through field 'entityExportComponent'; nes ted exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityExportComponentImpl': Unsatisfied dependency expressed through field 'versionsPlanComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dyVersionsPlanComponentImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'taskHandlerImpl': Bean with name 'taskHandlerImpl' has been injected into other beans [actionController,bizCommServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesForType' with the 'allowEagerInit' flag turned off, for example. 按这个报错信息来看 @Lazy应该加在哪个bean上
最新发布
10-21
2025-03-27 15:35:22.815 ERROR 26436 - [restartedMain] [o.s.b.web.embedded.tomcat.TomcatStarter,onStartup,61] : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'jwtFilter': Unsatisfied dependency expressed through field 'jwtUtil'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtUtil': Unsatisfied dependency expressed through field 'userCache'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userCache': 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 'userGroupService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'groupServiceImpl': Unsatisfied dependency expressed through field 'departmentService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'departmentServiceImpl': Unsatisfied dependency expressed through field 'deptUserService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deptUserServiceImpl': Unsatisfied dependency expressed through field 'userSetupService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userSetupServiceImpl': Unsatisfied dependency expressed through field 'roleService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'roleServiceImpl': Unsatisfied dependency expressed through field 'rolePrivService'; nested exception is org.springframework.beans.factory.UnsatisfiedDepend
03-28
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值