1. src/main/resources/applicationContext.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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">
<description>Spring Common Configuration</description>
<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
<context:component-scan base-package="com.dap.*">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!-- Enable annotation support for @AspectJ -->
<aop:aspectj-autoproxy />
<!-- Enable annotation support for asynchronous method execution -->
<task:annotation-driven executor="executor"/>
<task:executor id="executor" pool-size="5-10" queue-capacity="100"/>
<task:executor id="batchExecutor" pool-size="5-10" queue-capacity="100"/>
<task:executor id="calculatorExecutor" pool-size="10-20" queue-capacity="2000" rejection-policy="CALLER_RUNS"/>
<task:executor id="remoteFacadeExecutor" pool-size="5-10" queue-capacity="200" rejection-policy="CALLER_RUNS"/>
<task:executor id="quartzReplenishExecutor" pool-size="5-10" queue-capacity="20" rejection-policy="CALLER_RUNS"/>
<task:executor id="quartzPurchaseExecutor" pool-size="1-3" queue-capacity="10" rejection-policy="CALLER_RUNS"/>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 设置上传文件的最大尺寸为100MB -->
<property name="maxUploadSize">
<value>999999999</value>
</property>
</bean>
</beans>
2. src/main/resources/applicationContext-webservice.xml
<?xml version="1.0" encoding="UTF-8"?>
<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.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
<bean id="baseWebService"
class="org.codehaus.xfire.spring.remoting.XFireExporter" lazy-init="false" abstract="true">
<property name="xfire" ref="xfire" />
<property name="serviceFactory" ref="xfire.serviceFactory" />
</bean>
<bean id="userWS" class="com.dap.pub.web.register.DiagnosisAction" />
<bean id="uService" parent="baseWebService">
<property name="serviceBean" ref="userWS" />
<property name="serviceClass" value="com.dap.pub.web.register.webservice.PortalServiceInt" />
</bean>
</beans>
3. web.xml 中需要添加
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.spring.XFireSpringServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
4、jar包下载地址http://download.csdn.net/download/sinat_38273626/10204812
二、不使用用spring其他配置 jar 包中
web.xml需要添加
<servlet>
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
<init-param>
<param-name>config</param-name>
src目录下的 位置
<param-value>services.xml</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
service.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<service xmlns="http://xfire.codehaus.org/config/1.0" xmlns:s="http://www.springframework.org/schema/beans"
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-2.0.xsd">
<name>WebService</name>
<serviceClass>com.dap.pub.service.webService.WebService</serviceClass>
<implementationClass>com.dap.pub.web.register.DiagnosisAction
</implementationClass>
</service>
</beans>