Web Services Sping Boot Actuator端点在SOAP Web服务中无法访问

ndh0cuux  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(165)

我已经使用Sping Boot 创建了一个SOAP Web服务,它基于以下tuto:https://spring.io/guides/gs/producing-web-service/#scratch。
Web服务运行良好,但我无法访问通常嵌入在Sping 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;
    }
}

你知道吗?

66bbxpm5

66bbxpm51#

我的pom.xml文件中缺少spring-boot-starter-actuator依赖项。

相关问题