I am using Spring Boot 2.5.5 and CXF WS 3.4.5 to create a microservice, which will be on cloud. One of the requirements is to have a actuator. Monitoring services will check periodically if microservice is available.
I have the following code to publish endpoint
@Bean
public EndpointImpl endpoint() {
EndpointImpl endpoint = new EndpointImpl(bus, serviceName);
endpoint.getInInterceptors().add(wSS4JInInterceptor());
endpoint.getInInterceptors().add(loggingInInterceptor);
endpoint.getOutInterceptors().add(loggingOutInterceptor);
endpoint.setBindingUri(SOAP12HTTP_BINDING);
endpoint.publish("/servicename-service");
return endpoint;
}
WSDL is accessable via localhost:8082/service/servicename-service?wsdl
However, localhost:8082/actuator returns Whitelabel Error Page (404 Not Found). I tried many solutions from this and other website but none of it works.
I added the following code but it didnt help
@Bean
public ServletRegistrationBean cxfServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/service/*");
}
I tried also to override dispatcherServlet but it didnt help aswell.
@Bean
public DispatcherServlet dispatcherServlet() {
return new DispatcherServlet();
}
@Bean
public ServletRegistrationBean dispatcherServletRegistrationBean() {
ServletRegistrationBean dispatcherServlet = new ServletRegistrationBean(dispatcherServlet(), "/*");
dispatcherServlet.setOrder(2);
dispatcherServlet.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
return dispatcherServlet;
}
I don't exactly what failed during the process but it works without any problem right now. Those steps helped:
I even removed cxfServlet and set cxf.path=/service in application.yml to stay consistent with current functionality.