SpringBoot를 사용하여 웹프로젝트를 진행 중 아래와 같은 에러가 발생했다.
Parameter 3 of constructor in com.example.demo.service.contract.ContractBankServiceImpl required a bean of type 'com.example.demo.model.contract.Contract' that could not be found.
-> 흠...뭐 대충 ContractBankServiceImpl에서 생성자 매개변수 3이 찾을 수 없는 Contract 유형의 bean이 필요하다??? 즉, ContractBankServiceImpl의 Contract생성자가 사용이 안되고 있다는 뜻인거 같다.😅
ContractBankServiceImpl의 생성자는 대충 아래와 같다.
public class ContractServiceImpl implements ContractService {
private final RestTemplate restTemplate;
private final Gson gson;
private final ContractRepository contractRepository;
private final Contract contract;
}
근데 4개의 생성자 중에서 Contract 생성자는 만들어만 놓고 사용하지 않고 있는데, 이렇게 사용하지 않으면 위와 같은 에러가 뜨게 된다.
-> 오류를 해결한 ContractBankServiceImpl
(사용하지 않는 private final Contract contract를 지웠다.)
public class OpenBankServiceImpl implements OpenBankService {
private final RestTemplate restTemplate;
private final Gson gson;
private final ContractRepository contractRepository;
}
이것저것 시도해본 끝에 다행히 해결할 수 있어 좋았다.