In a standalone CXF ws, I will use the following to start Spring and loads my_cxf.xml file.
Now I need to integrate CXF into my existing application. My existing applicationt has is a customized MySpringLoader in place. Thus I can't use ContextLoaderListener to load cxf anymore.Code:<web-app> <context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/my_cxf.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <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> </web-app>
How can I plug in my code to initialize CXF model(which normal is doned throught ContextLoaderListener)?Code:<servlet> <servlet-name>context</servlet-name> <servlet-class> com.mycompany.MySpringLoader </servlet-class> <load-on-startup>1</load-on-startup> </servlet> public class MySpringLoader extends ContextLoaderServlet { public void init() throws ServletException { super.init(); WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(this .getServletContext()); // customized initialize the factory for the spring impl of SystemServices } }


Reply With Quote