【问题标题】:Global Interceptor for ws:outbound-gatewayws:outbound-gateway 的全局拦截器
【发布时间】:2016-04-11 18:21:32
【问题描述】:

Spring 集成的 ws:outbound-gateway 有一个拦截器和拦截器属性,它允许我为出站 springWS 定义一个 ClientInterceptor。

对于使用 springWS 的入站 Web 服务,我可以在 sws:interceptors 中定义一个 global 拦截器。我使用它来将所有入站请求记录到数据库中。

有没有办法为 ALL ws:outbound-gateway 实例定义拦截器?我想在数据库中记录所有 Web 服务的出站信息。

【问题讨论】:

    标签: spring-integration spring-ws


    【解决方案1】:

    嗯嗯。在这个问题上没有这样一个直接的高级 API。 虽然我猜我们会使用WebServiceTemplate 注入作为在任何地方接受相同实例的点。但是对于很多ws:outbound-gateway来说,无论如何都是注入。

    inbound 部分实际上基于单个入口点,例如MessageDispatcherServlet,但 outbound 有不同的,所以这就是为什么没有全局访问它们的原因。

    无论如何,我建议您在其中一个配置类中使用一些技巧:

    @Autowired
    private List<AbstractWebServiceOutboundGateway> outboundWsGateways;
    
    @PostConstruct
    public void setup() {
       for (AbstractWebServiceOutboundGateway gateway: this.outboundWsGateways) {
            gateway.setInterceptors(...);
       }
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-29
      • 1970-01-01
      • 2020-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 2019-09-12
      相关资源
      最近更新 更多