I have one bean Name “MasterService” that has the attribute autowired=”byType”. In that bean I have one property as
AccountService accountService;
And I have registered implementation of this bean as “DefaultAccountService”. Now somebody wants to extends ‘DefaultAccountService’ and create ‘CustomAccountService’. and also register but during initialization of “MasterService” getting the exception that 2 beans are there for AccountService [DefaultAccountService and CustomAccountService].
we dont know how to resolve this?
thanks in advance
you need the @Qualifier annotation
see this example:
http://www.mkyong.com/spring/spring-autowiring-qualifier-example/
in your case, it would be: