'Spring Boot Actuator endpoints unreachable in a SOAP web service
I've created a SOAP web service using Spring Boot, based on this tuto : https://spring.io/guides/gs/producing-web-service/#scratch.
The web service works great. But I can't reach the Actuator endpoints normally embedded in Spring Boot applications : /env, /health, etc.
Here is the main configuration class of my application :
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
public final static Logger logger = Logger.getLogger( WebServiceConfig.class );
@Autowired
private WSProperties wsProperties;
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext( applicationContext );
servlet.setTransformWsdlLocations( true );
String urlMappings = wsProperties.getLocationUri() + "/*";
return new ServletRegistrationBean( servlet, urlMappings );
}
/*
* Wsdl11Definition based on a static existing WSDL file
*/
@Bean(name = "myDomain")
public Wsdl11Definition staticWsdl11Definition( XsdSchema schema ){
logger.info("Loading Wsdl11Definition from existing WSDL file");
SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
wsdl11Definition.setWsdl( new ClassPathResource( wsProperties.getWsdlLocation() ) );
return wsdl11Definition;
}
@Bean
public XsdSchema schema() {
logger.info("Loading XSD schema");
return new SimpleXsdSchema( new ClassPathResource( wsProperties.getSchemaLocation() ) );
}
/*
* Declaration of the custom EsceptionResolver to customize SoapFault elements when some exception is thrown.
*/
@Bean(name = "soapFaultAnnotationExceptionResolver")
public DetailSoapFaultDefinitionExceptionResolver exceptionResolver( ApplicationContext applicationContext ){
DetailSoapFaultDefinitionExceptionResolver exceptionResolver = new DetailSoapFaultDefinitionExceptionResolver();
SoapFaultDefinition soapFaultDefinition = new SoapFaultDefinition();
soapFaultDefinition.setFaultCode( SoapFaultDefinition.SERVER );
exceptionResolver.setDefaultFault( soapFaultDefinition );
return exceptionResolver;
}
/*
* Message source for internationalization.
*/
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:locale/messages");
messageSource.setCacheSeconds(3600); // refresh cache once per hour
return messageSource;
}
}
Any idea ?
Solution 1:[1]
I was missing spring-boot-starter-actuator
dependency in my pom.xml
file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | vinzee |