0

このチュートリアルに基づいて、Spring Boot を使用して SOAP Web サービスを作成しました: https://spring.io/guides/gs/producing-web-service/#scratch

Web サービスはうまく機能します。しかし、Spring Boot アプリケーションに通常組み込まれているアクチュエータ エンドポイント (/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;
    }
}

何か案が ?

4

1 に答える 1

1

わかりました、ばかげた質問、ばかげた答え。

spring-boot-starter-actuatorファイルに依存関係がありませんでしたpom.xml...

于 2015-12-15T09:02:37.217 に答える