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>
質問
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?