Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add WebRequestTraceFilter in spring-boot-2?

I used to have the following configuration, but as of spring-boot-2.0 the WebRequestTraceFilter is no longer available.

@Bean
public FilterRegistrationBean filter(WebRequestTraceFilter filter) {
    FilterRegistrationBean registration = new FilterRegistrationBean(filter);
    registration.setUrlPatterns("subpath/*"));
    return registration;
}

What is the proper replacement of the filter above?

like image 578
membersound Avatar asked Jul 25 '18 11:07

membersound


1 Answers

In 2.0 tracing is intentionally less flexible as per comment in the below GitHub issue link.

https://github.com/spring-projects/spring-boot/issues/12953

I was able to implement something similar by extending HttpTraceFilter

like image 187
Garreth Golding Avatar answered Sep 17 '22 14:09

Garreth Golding