正文
spring 怎样将枚举项注入到bean的数组字段中
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
在配置文件的xmlns中引入util的scheam
xmlns:util=http://www.springframework.org/schema/util
在配置文件的xmlns:util="http://www.springframework.org/schema/util"中插入
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
装配样例
<bean id="hhh" class="com.hiaward.efwk.dsml.service.T" lazy-init="false">
<property name="haha">
<util:list value-type="com.hiaward.efwk.dsml.service.EE">
<value>A</value>
<value>C</value>
</util:list>
</property>
</bean>
EE是一个枚举类型;
T为需要装配的bean,具有一个类型为EE的枚举数组字段。
除此之外也有文章提到用convert,这个方法不好。