Java 未获取“创建单例bean的共享实例”
我正在使用Struts 2和Springs 4.0.0.M1,应用程序正在部署中。 未提及应用程序的范围,因此将其实例化为“Singleton”。 所有bean都是预先实例化和定义的,但我没有收到消息:- 创建单例bean的共享实例 因此,我猜测这些bean并没有被使用,这使得应用程序的生产速度变慢。 我也在使用一些论坛中建议的在bean中定义的类实现的接口 请导游 我的application-context.xml类似于Java 未获取“创建单例bean的共享实例”,java,spring,struts2,Java,Spring,Struts2,我正在使用Struts 2和Springs 4.0.0.M1,应用程序正在部署中。 未提及应用程序的范围,因此将其实例化为“Singleton”。 所有bean都是预先实例化和定义的,但我没有收到消息:- 创建单例bean的共享实例 因此,我猜测这些bean并没有被使用,这使得应用程序的生产速度变慢。 我也在使用一些论坛中建议的在bean中定义的类实现的接口 请导游 我的application-context.xml类似于 <beans xmlns="http://www.springfr
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.javahash.spring.controller" />
<bean id="login" class ="syntel.arch.action.SKBLoginAction">
<property name="skbLoginService">
<ref bean="skbLoginService"/>
</property>
</bean>
<bean id="skbLoginService" class="syntel.arch.service.impl.SKBLoginServiceImpl">
<property name="skbLoginDAO">
<ref bean="skbLoginDAO"/>
</property>
</bean>
</beans>
和web.xml
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-app_3_0.xsd"
version="3.0">
<display-name>skillbay</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>/jsp/redirect.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/applicationContext-JDBC.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<session-config>
<cookie-config>
<http-only>true</http-only>
</cookie-config>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>All JSP direct access</web-resource-name>
<url-pattern>/jsp/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<description>
No Access
</description>
<role-name>restricted</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>NO Access</description>
<role-name>restricted</role-name>
</security-role>
</web-app>
S2动作不应该是单例的,但是如果我在Spring4.0的位置使用Spring2.5.6。。我明白了。你能告诉我应该怎么做才能使应用程序成为单例应用程序吗?因为这会让应用程序在生产中大量使用。你为什么要使用一个古老的里程碑版本?对于初学者,我建议升级到4.0.4.0版本,这是Spring4.x系列中最后一个非里程碑版本。还要确保您已经正确地设置了Spring和Struts的集成。只是想知道您在哪里看到消息?JBoss服务器日志。当我在同一个塔中更改弹簧版本时。。我收到这些信息。不过我还是会将Springs版本更改为4.0.4。