InterceptorRegistry类及 addInterceptor方法

文档地址 https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/config/annotation/InterceptorRegistry.html

Class InterceptorRegistry

public class InterceptorRegistry extends Object

帮助配置映射拦截器列表。
Helps with configuring a list of mapped interceptors.

addInterceptor

public InterceptorRegistration addInterceptor(HandlerInterceptor interceptor)

添加提供的HandlerInterceptor。
Adds the provided HandlerInterceptor.

Parameters:

  • interceptor - the interceptor to add

Returns:
InterceptorRegistration 允许您选择性地进一步配置注册的拦截器,例如添加它应该适用的 URL 模式。
an InterceptorRegistration that allows you optionally configure the registered interceptor further for example adding URL patterns it should apply to.

posted @ 2025-04-12 18:36  kuki'  阅读(62)  评论(0)    收藏  举报