You can inject an empty list like this, however this is probably unnecessary, unless you're trying to setup an example template spring XML config perhaps.
<property name="cars">
<list></list>
</property>
If you want a quick way of setting empty lists to prevent null pointer problems, then just use Collections.emptyList(). You can also do it "inline' as follows. Note though that Collections.emptyList() returns an unmodifiable list.
public class StackOverflow {
private List<Car> cars = Collections.emptyList();
You'll also need getters and setters for cars to be able to use it from spring XML.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…