Spring integration http入站网关是否可以执行诸如拦截器的预处理和后处理之类的操作?
我想在服务接受http请求时将“UUID”放入MDC。 因为它便于日志搜索 我继承了HttpRequestHandlingMessagingGateway,发现HandlerRequest()是最终版本,因此无法覆盖它Spring integration http入站网关是否可以执行诸如拦截器的预处理和后处理之类的操作?,spring-integration,spring-dsl,Spring Integration,Spring Dsl,我想在服务接受http请求时将“UUID”放入MDC。 因为它便于日志搜索 我继承了HttpRequestHandlingMessagingGateway,发现HandlerRequest()是最终版本,因此无法覆盖它 那么,在接受请求(MDC.put())和写入响应(MDC.remove())时,有没有一种方法可以做些什么呢?好吧,以这种方式操作请求并不是HttpRequestHandlingMessagingGateway的责任 我认为您需要查看Web筛选器注册: 您可以借用现有的Abstr
那么,在接受请求(MDC.put())和写入响应(MDC.remove())时,有没有一种方法可以做些什么呢?好吧,以这种方式操作请求并不是HttpRequestHandlingMessagingGateway的责任 我认为您需要查看Web筛选器注册: 您可以借用现有的
AbstractRequestLoggingFilter
:
* Base class for {@code Filter}s that perform logging operations before and after a request
* is processed.
*
* <p>Subclasses should override the {@code beforeRequest(HttpServletRequest, String)} and
* {@code afterRequest(HttpServletRequest, String)} methods to perform the actual logging
* around the request.
*在请求前后执行日志记录操作的{@code Filter}的基类
*正在处理。
*
*子类应该重写{@code beforeRequest(HttpServletRequest,String)}和
*{@code afterRequest(HttpServletRequest,String)}方法来执行实际的日志记录
*围绕着请求。