You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package com.shanzhu.flower.config ;
import org.springframework.context.annotation.Configuration ;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry ;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer ;
/**
* Web MVC配置类, 用于配置Spring MVC的相关功能。
* 主要功能包括:
* - 添加拦截器,用于处理跨域请求等。
*
* @author: ShanZhu
* @date: 2024-01-24
*/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors ( InterceptorRegistry registry ) {
// 添加自定义的拦截器ProcessInterceptor
// ProcessInterceptor用于处理跨域请求和预请求( OPTIONS方法)
registry . addInterceptor ( new ProcessInterceptor ( ) )
// 指定拦截器的应用路径模式
// 使用"/**"表示拦截所有请求路径
. addPathPatterns ( "/**" ) ;
}
}