I have 2 services, EFT and Cheque that are substantially similar.
Runs fine if I mark the implementation as @service.
Otherwise I get a no such bean definition exception. No qualifying bean of type 'EftPaymentService'.
Top level interface.
public interface PaymentService { public void paymentsResponse(); } Eft service interface.
@Service public interface EftPaymentService extends PaymentService { public void processEft(String code) throws PaymentsException; } Cheque service interface
@Service public interface ChequePaymentService extends PaymentService { public void processCheque(String code) throws PaymentsException; } Top level implementation
public abstract class PaymentServiceImpl implements PaymentService { @Autowired protected SessionFactory sftpSessionFactory; @Autowired protected SftpConfig.UploadGateway gateway; public void paymentsResponse(){ } } Eft implementation
public class EftServiceImpl extends PaymentsServiceImpl implements EftPaymentService { } Cheque implementation
public class ChequeServiceImpl extends PaymentsServiceImpl implements ChequePaymentService { } What is going on here? Refactor using composition?
@Serviceis what you should do, what exactly is the problem?