If I have @Autowired List and no beans of SomeBeanClass, I get:
No matching bean of type [SomeBe
There are a few options with Spring 4 and Java 8:
@Autowired(required=false)
private List providers = new ArrayList<>();
You can also use java.util.Optional with a constructor:
@Autowired
public MyClass(Optional> opFoo) {
this.foo = opFoo.orElseGet(ArrayList::new);
}
You should also be able to autowire an a field with Optional, but I haven't used that yet.> opFoo;