Reputation: 797
As part of learning spring, I'm trying to declare a priority queue bean of MyMessageObject objects, but keep getting the following BeanCreationException: "Error creating bean with name 'messagesHeap' defined in URL [file:/my.app.spring.xml]: Could not resolve matching constructor"
Here's my spring definitions:
<bean id="messagesHeap" class="java.util.PriorityQueue">
<constructor-arg type="int" name="initialCapacity" value="100" index="0"/>
<constructor-arg name="comparator" type="java.util.Comparator" index="1" ref="orderComparator"/>
</bean>
<bean id="orderComparator" class="com.my.myComparator"/>
The class myComparator implements java.util.Comparator as required.
What am I doing wrong here?
Upvotes: 2
Views: 448
Reputation: 136002
try this
<bean id="messagesHeap" class="java.util.PriorityQueue">
<constructor-arg value="100" />
<constructor-arg ref="orderComparator" />
</bean>
Upvotes: 1