优化任务删除方法,核心代码注释
This commit is contained in:
@@ -6,14 +6,30 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* Web MVC 配置类
|
||||
* <p>
|
||||
* 实现 WebMvcConfigurer 接口,配置 Spring MVC 拦截器等功能。
|
||||
*/
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 认证拦截器
|
||||
*/
|
||||
private final AuthInterceptor authInterceptor;
|
||||
|
||||
/**
|
||||
* 注册拦截器
|
||||
* <p>
|
||||
* 将认证拦截器注册到拦截器链中,拦截所有 `/api/**` 路径的请求。
|
||||
*
|
||||
* @param registry 拦截器注册器
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(authInterceptor).addPathPatterns("/api/**");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user