"scope" must be declared for element type "bean"异常
来源:互联网 发布:刷枪软件怎么制作 编辑:程序博客网 时间:2024/06/05 20:16
今天把spring配置增加scope,但是启动异常,报,org.xml.sax.SAXParseException: Attribute "scope" must be declared for element type "bean".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
查了一下发现是原来Attribute "scope" 在spring2.0以后支持啊~~
spring的XML配置文件的这个:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
改成这个就可以了:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
附录:
Spring 2.0的XSD在描述Spring XML元数据格式方面比先前的DTD更丰富。 旧的DTD仍然得到支持,但如果可能我们鼓励在bean定义文件头部引用XSD文件。
有一点被改变了,那就是定义bean作用域的方式。如果你使用的是Spring 1.2 DTD,那么你能继续用'singleton'属性。 如果你选择引用新的Spring 2.0 DTD,它不允许使用'singleton'属性, 那么可以用'scope'属性来定义bean的生命周期作用域。
- "scope" must be declared for element type "bean"异常
- scope" must be declared for element type "bean"异常
- “scope” must be declared for element type “bean”异常
- Attribute "scope" must be declared for element type "bean"
- Attribute "scope" must be declared for element type "bean"-[spring]
- Attribute "scope" must be declared for element type "bean"
- Attribute "scope" must be declared for element type "bean"
- Attribute "nameSpace" must be declared for element type "sqlMap".
- Attribute "column" must be declared for element type "property"解决办法
- Attribute "column" must be declared for element type "property"解决办法
- Attribute "resultClass" must be declared for element type "insert".
- Attribute "statementType" must be declared for element type "procedure"
- 1.Attribute "table" must be declared for element type "subclass".
- Attribute "resultCalss" must be declared for element type "select".
- Attribute "resource" must be declared for element type "mapper".
- Attribute "column" must be declared for element type "property"解决办法
- 错误:Element type "select" must be declared.
- Element type "acton" must be declared.
- 在类Calculator中使用析构函数
- 过正常生活
- Flash 11 – UDK 和 Unity 到来
- 图片格式与调色板
- 1108\1109
- "scope" must be declared for element type "bean"异常
- Java反射访问私有变量和私有方法相关搜集
- WPF学习笔记之资源基础详解
- android 检查是否创建桌面快捷方式
- 团队沟通
- ActionScript & Flex中快速给ArrayCollection排序的方法
- 呵呵游戏而已
- VS2010, WPF工程添加图片资源
- 解决PcAnywhere 12.0在Windows 2003 Server中远程连接,WPF界面无法显示的问题