Spring中提示元素 'ref' 中不允许出现属性 'local'。
来源:互联网 发布:软件无线电技术与实现 编辑:程序博客网 时间:2024/06/03 07:20
在配spring的applicationContext.xml时,写到某处时 一直提示错误
<bean id="service" class="service.ServiceImpl"> <property name="dao"> <ref local="dao"/> <!--此处提示local属性出错--> </property></bean>
错误提示:cvc-complex-type.3.2.2: Attribute ‘local’ is not allowed to appear in element ‘ref’.
纳闷,别人用spring3.x的jar包 这么写都没问题,难道是我用的spring4.x版本不支持这样的写法了?
搜索之后,发现这个相似的帖子:
看了下面大神们的回复之后,总结下,解决方法分两种:
1、将 ref 子标签 作为property父标签的 属性之一,属性值即为原local属性的值
<property name="dataSource"> <ref local="dataSource"/></property> 改成下面试试 <property name="dataSource" ref="dataSource"/>
2、把local属性改为bean属性
<bean id="service" class="service.ServiceImpl"> <property name="dao"> <ref bean="dao"/> </property></bean>
这样即可,估计是spring新版本去掉了这个
0 0
- Spring中提示元素 'ref' 中不允许出现属性 'local'
- Spring中提示元素 'ref' 中不允许出现属性 'local'。
- Spring 配置文件中元素 'ref' 中不允许出现属性 'local'
- 元素 'ref' 中不允许出现属性 'local'
- 元素 'ref' 中不允许出现属性 'local'。
- cvc-complex-type.3.2.2: 元素 '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=""/>区别
- v4l2采集video视频数据生成视频文件demo
- ReactNative学习+项目集成之路【一】 环境搭建,运行Demo
- Node.js 写一个简单的服务器和TCP服务器,以及sumblimeText3简单使用
- 初识JavaScript (js)
- rxconsole APK
- Spring中提示元素 'ref' 中不允许出现属性 'local'。
- Windows7下载、安装、配置ADB的步骤
- linux中,ls -l命令显示的total的含义。
- 用Swift实现社交网络的卡片
- 用C/C++创建windows服务程序
- 快速排序(递归法与迭代法)
- poj 3495 Bitwise XOR of Arithmetic Progression
- RPG角色生成器(C++)
- [李景山php] ubuntu/centos 搭建 搭建 redis 集群