From 34c0e511b7413a991c5dfaa4a89f97309d012848 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Sat, 16 Jan 2021 21:49:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B5=84=E6=BA=90=E6=98=A0?= =?UTF-8?q?=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +- .../config/web/SpringMvcConfiguration.java | 38 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index d3ed8e1d..c515e0d4 100644 --- a/pom.xml +++ b/pom.xml @@ -147,16 +147,18 @@ org.projectlombok lombok + com.github.oshi oshi-core ${oshi.version} + - guns-standalone + guns org.springframework.boot diff --git a/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java b/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java index 661dda4f..8370f2c9 100644 --- a/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java +++ b/src/main/java/cn/stylefeng/guns/config/web/SpringMvcConfiguration.java @@ -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); } -} \ No newline at end of file + /** + * 配置项目拦截器 + * + * @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/"); + } + +}