spring2與spring1的單例模式的配置區別
Spring 1.*
<bean id="hibernateSessionFactory" class="org.hibernate.admin.component.HibernateSessionFactory" init-method="init" destroy-method="dispose" singleton="true">
Spring 2.0
spring-beans-2.0.dtd/xsd does not support singleton="true"/"false" anymore. Use scope="singleton/"prototype" instead!
<bean id="hibernateSessionFactory" class="org.hibernate.admin.component.HibernateSessionFactory" init-method="init" destroy-method="dispose" scope="singleton">
如果在spring2.0中使用spring1.*的單例屬性即會報錯:org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'singleton' is not allowed to appear in element 'bean'.
在spring2.0中,bean没有“singleton”这个属性,而是在“scope”中对它进行设定。“scope”可以设定为 “singleton”和“prototype”默认情况下是“singleton”即和原先的“singleton=true”性质一样,如果要实现单例模式则将“scope”设定为“prototype”,即和原先版本的“singleton=false”一样。
分享到:
相关推荐
解决 cvc-complex-type.2.4.d: Invalid content was found 具体参考http://henatne.iteye.com/blog/837186
主要给大家介绍了关于spring配置文件解析失败报”cvc-elt.1: 找不到元素 'beans' 的声明”异常的解决方法,需要的朋友可以参考下
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
BPMN2新规范 业界牛逼,流程建模设计,自动化,的工作流引擎
关于javascript经典例子 是一些基础功能
cvc-complex-type.2.4.a: Invalid content was found starting with element 'page-encoding'. One of '{"http:// java.sun.com/xml/ns/javaee":include-prelude, ...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document 'http:// code....
CVC-C07-01:2017A3 强制性产品认证实施细则-家用和类似用途设备.pdf
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources' 报错
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'. - schema_reference.4: Failed to read schema document '...
CVC-T 数据集是一个更广泛的数据集的测试集,称为 Endoscene。CVC-T 由从 36 名患者获得的 44 个视频序列中获得的 60 张图像组成。 一度找不到这个单独的数据集,但其实是包含在一整个医学分割网络的训练策略里的,...
dubbo.xsd文件,主要解决xml报错cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaratio
2018中国CVC行业发展报告-清华五道口-2019.1-88页
2018中国CVC行业发展报告-清华五道口-2019.1-88页.pdf
使用 dubbo 时需要添加 dubbo 支持,否则会报错 。cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dubbo:application'.
在写xml的时候又一次总是报cvc-complex-type.2.4.a: Invalid content was found starting with element 错误.解决方案文件