1、spring framework 4.02最新版下载地址:
http://repo.springsource.org/libs-release-local/org/springframework/spring
2、Attribute 'singleton' is not allowed to appear in element 'bean' 问题:
Spring 1.*
<bean id="hibernateSessionFactory" class="org.hibernate.admin.component.HibernateSessionFactory" init-method="init" destroy-method="dispose" singleton="true">
http://repo.springsource.org/libs-release-local/org/springframework/spring
2、Attribute 'singleton' is not allowed to appear in element 'bean' 问题:
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">
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">
3、struts2与spring整合时,报空指针NullPointerException异常的解决:
在spring配置文件中对于action的配置,假设id是useraction,那么在struts.xml中,不应该还是像以前单独用struts时那样,而是将在struts.xml中action的class=useraction。也就是: 将struts.xml中的action的class属性,由class名改为Spring中定义的bean的id名。
applicationContext.xml:
<bean id="login" class="com.action.LoginAction" scope="singleton">
<property name="log" ref="loginBusiness"/>
</bean>
struts.xml :
<action name="Login" class="login"> <!-- com.action.LoginAction -->
<result>/loginResult.jsp</result>
<result name="input">/login.jsp</result>
</action>
4、Cannot locate the chosen ObjectFactory implementation解决
添加struts2-spring-plugin-2.3.15.3.jar,
把struts.xml配置中的 <constant name="struts.objectFactory" value="spring" />
改成 <constant name="com.opensymphony.xwork2.ObjectFactory" value="spring" />
在spring配置文件中对于action的配置,假设id是useraction,那么在struts.xml中,不应该还是像以前单独用struts时那样,而是将在struts.xml中action的class=useraction。也就是: 将struts.xml中的action的class属性,由class名改为Spring中定义的bean的id名。
applicationContext.xml:
<bean id="login" class="com.action.LoginAction" scope="singleton">
<property name="log" ref="loginBusiness"/>
</bean>
struts.xml :
<action name="Login" class="login"> <!-- com.action.LoginAction -->
<result>/loginResult.jsp</result>
<result name="input">/login.jsp</result>
</action>
4、Cannot locate the chosen ObjectFactory implementation解决
添加struts2-spring-plugin-2.3.15.3.jar,
把struts.xml配置中的 <constant name="struts.objectFactory" value="spring" />
改成 <constant name="com.opensymphony.xwork2.ObjectFactory" value="spring" />
本文档提供了Spring 4.02版本的下载链接,并解答了Spring配置中关于单例属性的问题。同时,详细介绍了如何解决Struts2与Spring整合时出现的空指针异常及对象工厂定位错误。
173万+

被折叠的 条评论
为什么被折叠?



