conversionService注入过程

conversionService注入过程

一、org.springframework.context.support.AbstractApplicationContext

  • refresh→finishBeanFactoryInitialization→setConversionService

二、org.springframework.beans.factory.support.AbstractBeanFactory

  • getConversionService→initBeanWrapper→

三、org.springframework.beans.PropertyEditorRegistrySupport

  • 成员:conversionService/defaultEditors/customEditors
  • setConversionService→

四、org.springframework.beans.TypeConverterSupport

  • typeConverterDelegate→代理→convertIfNecessary

五、org.springframework.beans.SimpleTypeConverter

  • 完成typeConverterDelegate成员初始化

六、org.springframework.beans.TypeConverterDelegate

  • 数据字段:private final PropertyEditorRegistrySupport propertyEditorRegistry;
  • convertIfNecessary→进行类型转换系统会调用底层的conversionService.convert或调用doConvertValue传递PropertyEditor来实现
posted @ 2020-09-01 16:43  windlog  阅读(215)  评论(0编辑  收藏  举报