문제

XML:

<bean id="myBean" class="com.google.common.collect.HashMultimap">
  <constructor-arg index="0" value="200"/>
  <constructor-arg index="1" value="2"/>
</bean>

Is it correct? When I try to inject this bean in another like:

<property name="myBean" ref="myBean"/>

i received the error: Cannot apply property values to null instance

도움이 되었습니까?

해결책

try this

<bean id="myBean" factory-method="create" class="com.google.common.collect.HashMultimap">
    <constructor-arg index="0" value="200" />
    <constructor-arg index="1" value="2" />
</bean>

다른 팁

HashMultimap does not have a public constructor, therefore it's neither a Bean nor a POJO.

Source: google collections - HashMultimap

Instances are created using the static factory methods, among them one with no arguments (create()), maybe you can use this?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top