虽然CXF可以在单一服务器内管理多个日本宇宙航空研究开发厅-RS应用——我用自己的代码使用这一配置——但很复杂,你更不用改用星基配置。 <代码>CXFNon SpringJaxrsServlet只能支持有限配置。 在我的法典中,我有这种说法(因为我也使用春天的安全,但你可以放弃过滤):
<!-- Location of the main Spring/CXF configuration file -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<!-- Apply Spring Security as a wrapper to everything -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Hook for Spring lifecycle management; you want this -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- A single servlet to handle all CXF processing -->
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>