I'd like to exclude this endpoint URL from my global interceptor (the whole Controller):
@RequestMapping(value = "/api/rest/v1/company/{companyId}/store")
@RestController()
@RequiredArgsConstructor
@Slf4j
public class StoreController {
@GetMapping(with request params)
@PostMapping()
I tried many options like:
@Override
public void addInterceptors(InterceptorRegistry registry)
{
registry.addInterceptor(new GlobalInterceptor(taService, authService))
.excludePathPatterns("**/store")
.pathMatcher(new AntPathMatcher());
}
but without success.
Additionally I want to exclude patterns with query parameters like:
/api/rest/v1/company/{companyId}/store?param1=abc¶m2=def
And probably I should exclude all Swagger urls
I found a solution (there was missing slash "/"):
@Override
public void addInterceptors(InterceptorRegistry registry)
{
registry.addInterceptor(new GlobalInterceptor(taService, authService))
.excludePathPatterns("/**/store")
.pathMatcher(new AntPathMatcher());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.