Spring中XML配置注入枚举类型值

http://stackoverflow.com/questions/14072314/inject-the-value-of-an-enum-into-a-property-using-spring

<bean id="firstKey" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
  <property name="targetObject"><util:constant static-field="package.MyEnum.ABC"/></property>
  <property name="targetMethod" value="value" />
</bean>


即使用方式即可
<util:constant static-field="package.MyEnum.ABC"/>

猜你喜欢

转载自darrenzhu.iteye.com/blog/2250678