没有得到"创建单例bean的共享实例"

时间:2014-05-05 10:53:08

标签: java spring struts2

我正在使用Struts 2和Springs 4.0.0.M1,应用程序正在部署。 没有提到应用程序的范围,因此它被实例化为“Singleton”。 所有的bean都是预先实例化和定义的但是我没有收到消息: - “创建单例bean的共享实例”。

所以我猜这些bean没有被使用,使得应用程序在生产中变慢。 我正在使用接口,我的类在bean中定义,如某些论坛中所建议的那样。

请指导。

我的application-context.xml就像

<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>

0 个答案:

没有答案