<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>publishContext</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
<url-pattern>*.json</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SpringMVCContext2SpringContext</servlet-name>
<servlet-class>cn.com.gome.finance.gfs.api.servlet.SpringMVCContext2SpringContext</servlet-class>
<init-param>
<param-name>springMVCServletName</param-name>
<param-value>springmvc</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
/**
* 将springmvc上下文设置为spring上下文
* @author baolong
*
*/
public class SpringMVCContext2SpringContext extends HttpServlet {
/**
*
*/
@Override
public void init() throws ServletException {
BeanFactory wac = (BeanFactory)this.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
BeanFactory springMVCContext = (BeanFactory)this.getServletContext().getAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT."+this.getInitParameter("springMVCServletName"));
this.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, springMVCContext);
}
}