在spring中BeanDefinitionDocumentReader的主要作用是解析bean.xml配置文件
BeanDefinitionDocumentReader是一个接口,通过实例化工作createBeanDefinitionDocumentReader()而获得,而此时BeanDefinitionDocumentReader的类型则转换成DefaultBeanDefinitionDocumentReader了,这个类的一个重要作用就是获得配置文件的ROOT,以便将ROOT作为参数继续BeanDefinition注册
之后就是对配置文件的解析
preProcessXml(root)方法和postProcessXml(root)方法在spring的源代码中为空方法,为什么空的方法还要写呢?在面向对象设计方法学中常说的一句话,一个类要么面向继承设计的,要么就用final修饰,在DefaultBeanDefinitionDocumentReader并没有用final修饰,所以他是面向继承所修饰,这两个方法是为了方便程序员自定义子类,在解析bean.xml文件之前和之后进行操作