为什么spring源码org.springframework.web.servlet.HandlerExecutionChain中会有数组类型的拦截器和列表类型的interceptorList?这有必要吗?
public class HandlerExecutionChain {
private final Object handler;
@Nullable
private HandlerInterceptor[] interceptors;
@Nullable
private List<HandlerInterceptor> interceptorList;
.....
}发布于 2020-02-18 15:37:05
当您查看the source code时,您将看到只有HandlerInterceptor[] interceptors仅在HandlerExecutionChain之外返回:
public HandlerInterceptor[] getInterceptors() {您还可以查看用于创建List<HandlerInterceptor> interceptorList的List<HandlerInterceptor> initInterceptorList(。它看起来像是interceptorList集合,它有助于创建稍后在外部公开的interceptors数组。
https://stackoverflow.com/questions/60273268
复制相似问题