Spring 配置文件 属性 ref bean和local的区别
2009-06-09 09:21
666 查看
经常的<ref bean="aaa"/>或者<ref local="bbb"/>,这两者有什么区别?
看了http://www.springframework.org/dtd/spring-beans.dtd才明白,原来bean的类型是CDATA,local是IDREF,这表示,如果用local,那么,当前xml中必须存在id为"bbb"的bean声明,否则xml validator会报错的。
这也是local的本来含义,“本地”的bean。
如果<ref>指向的bean是在其它的配置中声明的,那么,必须用bean属性设置
看了http://www.springframework.org/dtd/spring-beans.dtd才明白,原来bean的类型是CDATA,local是IDREF,这表示,如果用local,那么,当前xml中必须存在id为"bbb"的bean声明,否则xml validator会报错的。
这也是local的本来含义,“本地”的bean。
如果<ref>指向的bean是在其它的配置中声明的,那么,必须用bean属性设置
相关文章推荐
- Spring 配置文件 属性 ref bean和local的区别
- SPRING里的配置文件里<ref local=""和<ref bean=""区别
- Spring配置文件中使用ref local与ref bean的区别. 在ApplicationResources.properties文件中,使用<ref bean>与<ref local>方法如下
- Spring配置文件中使用ref local与ref bean的区别.
- Spring配置文件中使用ref local与ref bean的区别
- Spring配置文件中使用ref local与ref bean的区别. 在ApplicationResources.properties文件中,使用<ref bean>与<ref local>方法如下
- Spring配置文件中使用ref local与ref bean的区别. 在ApplicationResources.properties文件中,使用<ref bean>与<ref local>方法如下
- spring配置文件中bean的属性name与id的区别
- Spring 配置文件中Bean 属性id和name的区别
- spring管理属性配置文件properties——PropertiesFactoryBean和PropertyPlaceholderConfigurer的区别
- spring配置文件中<bean>的id和name属性区别,以及identifier和aliases
- Spring 配置文件中元素 'ref' 中不允许出现属性 'local'
- Spring-配置文件Bean定义中parent属性详解
- spring管理属性配置文件properties——使用PropertiesFactoryBean
- [Spring][Bean]Spring配置文件、属性注入、从IOC容器获取实例
- Spring-配置文件Bean定义中parent属性详解
- Spring-配置文件Bean定义中parent属性详解
- spring配置文件中bean中scope属性prototype和singleton
- spring配置文件中Bean中的id和name的区别
- Spring中ref local与ref bean区别