I have a Collection instruments; in my SomeClass.java and I declare in my temp.xml file a bean of the class SomeClass.java. In the xml I add two string objects to the collection.
My question is Collection is an interface so I cannot instantiate it and List is also an interface so I don’t think we can do
Collection<String> someCollection = new List<String>();
I would like to know how the java code works when we use the list tag in the xml file. Meaning do the objects get stored in a linked list or arraylist or some type of list?
This depends on the
ApplicationContext. Each implementation could be different, but you can be sure that the result is aList. Accoding documentation:Checking the implementation of
ListFactoryBeanyou could see thatArrayListis the default list implementation that is instantiated if no specific list type is provided. The piece of code that does this task is: