我们可以自定义属性编辑器对类中的实例对象赋值,通过string类型值转换成对象类型值进行赋值。当我们使用下列方式注册时:
<bean id="PropertyEditorConfigurer1"
class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="renchaofeng_propertyEditor.Education" value="renchaofeng_propertyEditor.TestPropertyEditor"/>
</map>
</property>
</bean>
上面方式把我们自己定义的属性编辑器renchaofeng_propertyEditor.TestPropertyEditor注入到org.springframework.beans.factory.config.CustomEditorConfigurer的customEditors属性中,就可以达到转换的效果,那么原理流程是怎样的呢?如下:
org.springframework.beans.factory.config.CustomEditorConfigurer实现了BeanFactoryPostProcessor接口,所以会实现postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)方法,在此方法中代码如下&#x