Reputation: 86627
I'm providing a soap
webservice with java-first approach, thus using CXF
for this. To make it publishing with spring-boot
, I have the following dispatcher servlet:
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new CXFServlet(), "/services/*");
registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
return registration;
}
This works fine, but I now want to offer a REST
service aside. The rest service should NOT be published by cxf, but by the default spring mapping:
@RestConstroller
@RequestMapping("/rest/content")
public class MyServiceRest extends SpringBeanAutowiringSupport {
}
The result of this:
localhost:8080/app-name/rest/content
results in HTTP 404.localhost:8080/app-name/services/rest/content
shows a spring message "No service was found."
So, somehow the latter is inside the context of the CXFServlet
, and the REST service is not found.
What do I have to change to make this setup work?
By the way: when I remove the ServletRegistrationBean
, the rest service works as expected. But that's not an option as I have to offer the soap service alongside.
Upvotes: 1
Views: 1620
Reputation: 116031
Your bean named dispatcherServletRegistration
is replacing Spring Boot's default DispatcherServlet
so your left with just a CXFServlet
and no DispatcherServlet
in your application.
Update your bean to register the CXFServlet
to something like this:
@Bean
public ServletRegistrationBean cxfServletRegistration() {
return new ServletRegistrationBean(new CXFServlet(), "/services/*");
}
Upvotes: 2