开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜