首页 > 解决方案 > 创建名称为“centralPagamentoPfController”的 bean 时出错:通过字段“服务”表示的依赖关系不满足;

问题描述

创建名称为“centralPagamentoPfController”的 bean 时出错:通过字段“服务”表示的依赖关系不满足;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为 'centralPagamentoPfImpl' 的 bean 时出错:通过字段 'simulaPagamentoEntryDTO' 表达的依赖关系不满足;嵌套异常是 org.springframework.beans.factory.NoSuchBeanDefinitionException:没有“br.com.itau.internet.mobile.pagamento.model.dto.PagamentoPfSimulacaoRequest”类型的合格 bean 可用:预计至少有 1 个符合自动装配候选资格的 bean。依赖注解:{@org.springframework.beans.factory.annotation.Autowired(required=true)}

@RestController
@RequestMapping("/central_pagamentos")
public class CentralPagamentoPfController extends SummerControllerBase{


    @Autowired
    private CentralPagamentoPfService service;


                //-------PAGAMENTO------------//
    @PostMapping(value = "/pagamento/simular")
    public Protocol simularPagamentoPf(@RequestBody EntryProtocol entryProtocol){

        return service.simularPagamento(entryProtocol, ACTION_SIMULAR_PAGAMENTO, OPKEY_SIMULAR_PAGAMENTO);
    }

...................................................

public interface CentralPagamentoPfService {

    Protocol simularPagamento(final EntryProtocol entryProtocol, String action, String opkey);
}

……………………………………………………………………………………………………………………………………

@Service
public class CentralPagamentoPfImpl implements CentralPagamentoPfService, EstatisticaFactory {


     @Autowired
    private PagamentoPfSimulacaoRequest simulaPagamentoEntryDTO;

     @Override
    public Protocol simularPagamento(EntryProtocol entryProtocol, String action, String opkey){

            PagamentoPfSimulacaoRequest entity = entryProtocol.getBodyAs(PagamentoPfSimulacaoRequest.class);


        //code

   }

}

………………………………………………………………………………

public class PagamentoPfSimulacaoRequest implements Serializable{


    @JsonProperty("canal_pagamento")
    private CanalPagamentoDto canalPagamento;


    @JsonProperty("codigo_terminal")
    private String codigoTerminal;

    // geter e setter
}

标签: javaspringmodel-view-controllerjbossbackend

解决方案


推荐阅读