我正在尝试初始化此地图 bean:
<bean id="totalEventCountStore" class="java.util.concurrent.ConcurrentHashMap">
<constructor-arg type="java.util.Map">
<map key-type="com.company.EventType" value-type="java.util.concurrent.atomic.AtomicLong">
<entry key="ROUTED_REQUEST">
<bean class="java.util.concurrent.atomic.AtomicLong">
<constructor-arg index="0" type="long" value="0"/>
</bean>
</entry>
.... more entries .....
</bean>
我得到:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'totalEventCountStore' defined in class path resource [diagnostics.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [int]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
有谁知道为什么会这样?ConcurrentHashMap
只有一个带Map
参数的构造函数。
谢谢。