|
|
|
@ -11,6 +11,7 @@ import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.context.annotation.Import;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -31,18 +32,6 @@ public class SpringMvcConfiguration implements WebMvcConfigurer {
|
|
|
|
|
@Resource
|
|
|
|
|
private PermissionSecurityInterceptor permissionSecurityInterceptor;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 配置项目拦截器
|
|
|
|
|
*
|
|
|
|
|
* @author fengshuonan
|
|
|
|
|
* @date 2020/12/18 9:43
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
|
|
registry.addInterceptor(authJwtTokenSecurityInterceptor);
|
|
|
|
|
registry.addInterceptor(permissionSecurityInterceptor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 重写系统的默认错误提示
|
|
|
|
|
*
|
|
|
|
@ -79,4 +68,27 @@ public class SpringMvcConfiguration implements WebMvcConfigurer {
|
|
|
|
|
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance).serializerByType(Long.TYPE, ToStringSerializer.instance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 配置项目拦截器
|
|
|
|
|
*
|
|
|
|
|
* @author fengshuonan
|
|
|
|
|
* @date 2020/12/18 9:43
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
|
|
registry.addInterceptor(authJwtTokenSecurityInterceptor);
|
|
|
|
|
registry.addInterceptor(permissionSecurityInterceptor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 静态资源映射
|
|
|
|
|
*
|
|
|
|
|
* @author fengshuonan
|
|
|
|
|
* @date 2021/1/16 21:45
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
|
|
registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/assets/");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|