I know we can map different url to different interceptor, or we can map multiple url to single interceptor too. I am just curious to know if we also have exclude option. for exa
In my case:
/api/v1/user-manager-service/tenants/add
there was incorrect PathPattern configuration:
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new RequestInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/tenants/**");
}
I was missing:
/**
before actual path.
After correction it works as expected:
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new RequestInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/**/tenants/**");
}