Below are the classes and the error mentioned. Spring version: 5+
public interface CustomGenerator<T,R> {
void generate();
}
@Service
public abstract class AbstractGenerator<T extends CustomClassA, R extends CustomClassB>
implements CustomGenerator<T,R> {}
@Service
public class ConcreteC1 extends AbstractGenerator<CustomClassA, CustomClassB>{
void generate(){
...
}
}
@Service
public class ConcreteC2 extends AbstractGenerator<CustomClassA, CustomClassB>{
void generate(){
...
}
}
@Service
public class CustomService {
@Autowired
private List<CustomGenerator<CustomClassA, CustomClassB>> customGenerators;
// Expected: ConcreteC1 & ConcreteC1 instances in the list
}
Error: org.springframework.beans.factory.UnsatisfiedDependencyException Unsatisfied dependency expressed through field 'customGenerators' nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type.
I want a list of concrete classes instead of utilizing qualifiers to pick one by one, as I want to execute the generate method for all the elements in the list at once. Thanks for any help in advance.