Reputation: 86855
Prior to cxf-3.1.0
one could use new org.apache.cxf.transport.servlet.CXFServlet()
to instantiate the servlet, or via web.xml
configuration:
<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>
But now when I upgrade to 3.1.0, the class cannot be found anymore.
How could the the servlet be created with cxf?
Upvotes: 1
Views: 3106
Reputation: 4683
I have a simple spring boot application that works correctly with CXFServlet - here is the extract from pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DemoApplication</start-class>
<java.version>1.7</java.version>
<cxf.version>3.1.0</cxf.version>
</properties>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
And I simply create new servlet like
@SpringBootApplication
@ImportResource({"classpath:/cxf-servlet.xml" })
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Bean
public ServletRegistrationBean cxfServlet() {
org.apache.cxf.transport.servlet.CXFServlet cxfServlet = new org.apache.cxf.transport.servlet.CXFServlet();
ServletRegistrationBean servletDef = new ServletRegistrationBean(cxfServlet, "/cxf/*");
servletDef.setLoadOnStartup(1);
return servletDef;
}
}
Upvotes: 2