【问题标题】:How to access Spring Boot Actuator (Production-ready features) in a spring boot ws如何在 Spring Boot ws 中访问 Spring Boot Actuator(生产就绪功能)
【发布时间】:2015-04-02 18:14:22
【问题描述】:

我已经初始化了一个 P.O.C.基于优秀 spring.io/guides/gs/producing-web-service/

主要是ws初始化禁用所有Spring Boot Actuator(/env,/health等......)以及更普遍的静态和动态资源(CSS / @Controller ...)

我发现问题来自dispatcherServlet bean的声明代码:

@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {

@Bean
public ServletRegistrationBean dispatcherServlet(
        ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setApplicationContext(applicationContext);
    servlet.setTransformWsdlLocations(true);
    return new ServletRegistrationBean(servlet, "/ws/*");
}   

@Bean(name = "createEL")
public DefaultWsdl11Definition defaultWsdl11DefinitionCreateEL(
        XsdSchema creatElSchema) {

    DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
    wsdl11Definition.setPortTypeName("CreateELPort");
    wsdl11Definition.setLocationUri("/ws");
    wsdl11Definition.setTargetNamespace(NamespaceURI.DEFAULT_NAMESPACE_URI);
    wsdl11Definition.setSchema(createELSchema);
    return wsdl11Definition;
}
[...]

它钩住了所有东西......而且我不知道如何告诉 spring 让一些 URL 工作/通过......

谢谢!

【问题讨论】:

  • 我在回复日期后编辑了我的帖子

标签: java web-services spring-mvc spring-boot spring-ws


【解决方案1】:

如果您避免为 WS 调度程序使用 bean 名称“dispatcherServlet”,它应该可以正常工作(您使用该 bean 名称关闭了默认调度程序) - 顺便说一下,它实际上已经在指南中说明了这一点。我更新它做相反的事情(不替换默认调度程序),所以也许这样更容易理解?

【讨论】:

  • 感谢 Dave,它可能是:public ServletRegistrationBean messageDispatcherServlet( 而不是 public ServletRegistrationBean dispatcherServlet(
猜你喜欢
  • 2016-06-01
  • 2020-09-15
  • 2021-05-14
  • 2019-01-08
  • 2018-10-15
  • 1970-01-01
  • 2017-03-23
  • 2021-12-03
  • 2013-10-12
相关资源
最近更新 更多