Spring4.0版本以后customEditors属性为Map<Class<?>, Class<? extends PropertyEditor>>,所以用key(对应要编辑的属性类别,即要编辑类的全称,含包名)、value(该类对应的属性编辑器bean)在applicationcontext.xml中进行配置
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="customEditors"> <map> <entry key="Chapter5.Car" value="Chapter5.CustomCarEditor"> </entry> </map> </property> </bean>
时间: 2024-10-21 00:15:13