How to set Class<?> as property value in spring application context?
Is there a way to configure spring application context so it will initialize the setter with value of type Class?
I need to initialize that structure:开发者_JAVA百科 Map<Class<?>, Object>
Have you tried something like this:
<bean id="myBean" class="myBean">
<!-- This will set a map onto the property classMap of myBean -->
<property name="classMap">
<map key-type="java.lang.Class">
<entry key="java.lang.String" value="A String keyed by the class 'java.lang.String'" />
</map>
</property>
</bean>
精彩评论