cvc-complex-type.2.3: Element 'beans' cannot have character [children]

在编写Spring的applicationContext.xml文件时,无缘无辜出现了:

cvc-complex-type.2.3: Element 'beans' cannot have character [children], because the type's content type is element-only.错误。

错误原因:Spring在初始化的时候无法识别applicationContext.xml中的元素。

可能产生该错误的原因:网上复制的代码直接粘贴到了xml文件中,而网上的代码可能不符合xml规范

解决办法:1.去掉xml文件中的中文注解,因为复制的有些注解Spring不能识别。 

                  2.若仍然有错,则尝试修改多余的空格,因为中文空格Spring有可能识别错误。

                  3.最后的绝招:重新手动抄写一遍文件内容,保存。
---------------------
作者:风火一回
来源:CSDN
原文:https://blog.csdn.net/mafan121/article/details/43266733
版权声明:本文为博主原创文章,转载请附上博文链接!