Resolving Spring error: No unique bean of type is defined expected single matching bean but found 2


Error for ServeChild1Controller: No unique bean of type [com.service.ParentService] is defined: expected single matching bean but found 2 child1service, child2service

This error occurs if there are two beans implementing the same interface and referenced.

public interface ParentService{}
@Service("child1service")    
public class Child1 implements ParentService{}

@Service("child2service")
public class Child2 implements ParentService{}
public class ServeChild1Controller extends AbstractController{

 @Autowired
 public ServeChild1Controller(@Qualifier("child1service") ParentService child1service){
 super(child1service)
  } 

The following problem can be resolved using @Qualifier

@Service("child1service")
@Qualifier("child1service")
public class Child1 implements ParentService{}

@Service("child2service")
@Qualifier("child2service")
public class Child2 implements ParentService{}