Spring中具有相同名称的多个字段

时间:2014-11-06 10:50:26

标签: java spring autowired entity-bean

我有以下内容:

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
}

和2个班级。一个索赔和一个罚款都延长了债务。 我收到错误More than one field with type interface domain.debt.DebtRepository

我该怎么办?

1 个答案:

答案 0 :(得分:4)

如果你还没有这样做,请升级到Spring 4.0:

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