Spring配置文件中使用ref local与ref bean的区别.
来源:互联网 发布:做片头的软件 编辑:程序博客网 时间:2024/04/29 04:12
Spring配置文件中使用ref local与ref bean的区别.
在ApplicationResources.properties文件中,使用<ref bean>与<ref local>方法如下:
< bean id = "userDAOProxy"
class = "org.springframework.transaction.interceptor.TransactionProxyFactoryBean" >
< property name = "transactionManager" >
< ref bean = "transactionManager" />
</ property >
< property name = "target" >
< ref local = "UserDAO" />
</ property >
</ bean >
1 .用 local 属性指定目标 bean 可以利用 xml 解析器的能力在同一个文件中验证 xml id 引用 . 如果在同一个文件中没有匹 配的元素 ,xml 解析器就会产生一个 error, 所以如果目标 bean 在同一个 xml 文件中 , 那么用 local 形式是最好的选择 .
2 .可以这么说, <ref bean 是寻找全局中的 bean; <ref local 是寻找本 xml 文件中定义的 bean.
3. <ref> 提供了如下几方面的属性 :
1)bean: 在当前 Spring XML 配置文件中,或者在同一 BeanFactory(ApplicationContext) 中的其他 JavaBean 中 .
2)local: 在当前 Spring XML 配置文件中 . 其依赖的 JavaBean 必须存在于当前 Spring XML 培植文件中 . 如果借助 于 Spring IDE, 则在编译期可以对其依赖的 JavaBean 进行验证。基于 local 方式,开发者能够使用到 XML 本身提供 的优势,而进行验证。
3)parent: 用于指定其依赖的父 JavaBean 定义。
- 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中ref local与ref bean区别
- Spring中ref local与ref bean区别
- 转:Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别:
- Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别
- [转]Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别:
- Spring中<ref local=""/>与<ref bean=""/>区别
- Spring中<ref local=""/>与<ref bean=""/>区别
- Spring中ref local与ref bean区别
- Spring中ref local与ref bean区别
- 对对碰交换两个点后检查可消对象的算法.
- CORBA
- 1-oracle的基本操作之----《对表的操作》
- 结婚前后
- “80后”大学毕业关键词
- Spring配置文件中使用ref local与ref bean的区别.
- 中国人误传了数千年的七句话
- union和union all的区别
- 让我们用MindManager进行顺藤摸瓜式地进行思维导图表达
- Laser designer
- 线程模型
- 如何整合Apache和Tomcat
- 挺不错的辞职申请
- Windows GDI和GDI+编程实例剖析(2)