I have written code that uses spring util namespace. I have a class named City with the following properties:
private List<String> name;
private List<String> state;
private List<Integer> population;
//setter and getter methods go here ...
and I configured the application context as:
<util:list id="cities" list-class="java.util.ArrayList">
p:name="chennai" p:state="tamilnadu" p:population="2000000"/>
<bean class="com.example2.City"
p:name="bang" p:state="karnataka" p:population="3000000"/>
</util:list>
When I run the application it gives me the following error:
Exception in thread "main" java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.example2.City
Will someone help me out? Thanks.