我已经使用 Spring Boot 创建了一个 SOAP Web 服务,基于这个教程:https ://spring.io/guides/gs/produce-web-service/#scratch 。
网络服务很好用。但我无法访问通常嵌入在 Spring Boot 应用程序中的 Actuator 端点:/env、/health 等。
这是我的应用程序的主要配置类:
@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;
}
}
任何的想法 ?