Multiple field with identical name in Spring

67 views Asked by At

I've got the following:

public class ClaimFacadeImpl implements ClaimFacade {

    @Autowired
    private DebtRepository<Claim> debtRepository;

    @Autowired
    private DebtRepository<Fine> fineRepository;

    //other stuff

}

public interface DebtRepository <T extends Debt> {
   //nothing special
}

public class DebtRepositoryImpl <T extends Debt> implements DebtRepository <T> {
   //nothing special
}

and 2 classes. One Claim and one Fine both extending Debt. I'm getting the error More than one field with type interface domain.debt.DebtRepository

what should I do?

1

There are 1 answers

0
J-16 SDiZ On BEST ANSWER

Upgrade to Spring 4.0 if you have not done it already:

See http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics