I've created a bean that expects to be injected with all beans of a given type... something like this:
public class MyClass {
private List<MyOtherBean> myOtherBeansList;
....
@Inject
public void setMyOtherBeanList(List<MyOtherBean> otherBeanList) {
this.myOtherBeansList = otherBeanList;
}
This works fine, except when I have no beans of type 'MyOtherBeans' defined. In my business logic, that's ok! But spring doesn't like it and throws the overly familiar:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type...
exception. Does anyone know of a way to get spring to just pass me null in that case?