今天在做SSH框架Demo实例时,在ApplicationResources.properties文件时对
与
感到不解,经查找资料才弄明白,如下: 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 形式是最好的选择 .
3 、
提供了如下几方面的属性 : |
Spring中ref local与ref bean区别
最新推荐文章于 2022-06-12 18:02:47 发布