struts2+spring配置问题

struts.xml:

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
       
<struts>
    
     <include file="struts-default.xml"/>
     <constant name="struts.objectFactory" value="spring" />
  <bean type="com.opensymphony.xwork2.ObjectFactory" name="spring"
         class="org.apache.struts2.spring.StrutsSpringObjectFactory" />

     <include file="struts-login.xml"></include>

</struts>

 


struts-login.xml:

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
       
<struts>
    
     <package name="com.oohla.uni.sysadmin.ui.action.login" namespace="/login" extends="struts-default"> 
        <action name="login" class="loginAction">
         <result>/common/main.jsp</result>
            <result name="relogin">/login.jsp</result>
        </action>
       
        <action name="validate" class="com.oohla.uni.sysadmin.web.ValidateAction">
        </action>
    </package>
   
</struts>

 

 

applicationContext.xml:

<?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">
<beans>
 <!-- 登录 -->
    <import resource="classpath:applicationContext-login.xml" />
   
</beans>

 

applicationContext-login.xml:

<?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">
<beans>

    <bean id="loginAction" class="com.oohla.uni.sysadmin.login.ui.action.LoginAction" scope="prototype">
        <property name="loginService" ref="loginService"></property>
        <property name="contactBiz" ref="contactBiz"></property>
    </bean>
 
</beans>

 

applicationContext-service.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://cxf.apache.org/jaxws
       http://cxf.apache.org/schemas/jaxws.xsd">
  
    <import resource="classpath:META-INF/cxf/cxf.xml" /> 
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
   
    <!-- 创建登陆接口 -->
    <bean id="loginService" class="com.oohla.uni.sso.user.LoginService"
          factory-bean="proxyLoginService" 
          factory-method="create"/>
    <!-- 登陆接口工厂 -->
    <bean id="proxyLoginService" class="org.apache.cxf.frontend.ClientProxyFactoryBean">
        <property name="serviceClass" value="com.oohla.uni.sso.user.LoginService"/>
        <property name="address" value="http://192.168.0.150:9000/api/v1/sso/user/LoginService"/>
    </bean>
   
  
    <!-- 数据库操作接口 -->
    <bean id="contactBiz" class="com.oohla.uni.database.biz.ContactBiz"
          factory-bean="proxyService" 
          factory-method="create"/>
    <!-- 数据库操作工厂 -->
    <bean id="proxyService" class="org.apache.cxf.frontend.ClientProxyFactoryBean">
        <property name="serviceClass" value="com.oohla.uni.database.biz.ContactBiz"/>
        <property name="address" value="http://192.168.0.150:9000/api/v1/database/ContactBiz"/>
    </bean>
</beans>

 

 

你可能感兴趣的:(apache,spring,bean,struts,SSO)