From 0aaa4d7495d3040c5f783810495b0105662ac0ae Mon Sep 17 00:00:00 2001 From: zlt2000 Date: Sun, 12 Apr 2020 22:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9DefaultWebMvcConfig=E7=B1=BB?= =?UTF-8?q?=E7=94=B1WebMvcConfigurationSupport=E6=94=B9=E4=B8=BAWebMvcConf?= =?UTF-8?q?igurer=EF=BC=8C=E9=81=BF=E5=85=8D=E8=A6=86=E7=9B=96=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=9A=84WebMvc=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/config/DefaultWebMvcConfig.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/zlt-commons/zlt-common-core/src/main/java/com/central/common/config/DefaultWebMvcConfig.java b/zlt-commons/zlt-common-core/src/main/java/com/central/common/config/DefaultWebMvcConfig.java index 297dee5..d2d446e 100644 --- a/zlt-commons/zlt-common-core/src/main/java/com/central/common/config/DefaultWebMvcConfig.java +++ b/zlt-commons/zlt-common-core/src/main/java/com/central/common/config/DefaultWebMvcConfig.java @@ -6,8 +6,7 @@ import com.central.common.resolver.TokenArgumentResolver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.List; @@ -16,8 +15,11 @@ import java.util.List; * * @author zlt * @date 2019/8/5 + *

+ * Blog: https://blog.csdn.net/zlt2000 + * Github: https://github.com/zlt2000 */ -public class DefaultWebMvcConfig extends WebMvcConfigurationSupport { +public class DefaultWebMvcConfig implements WebMvcConfigurer { @Lazy @Autowired private UserService userService; @@ -34,17 +36,4 @@ public class DefaultWebMvcConfig extends WebMvcConfigurationSupport { //注入应用信息 argumentResolvers.add(new ClientArgumentResolver()); } - - /** - * 设置资源文件目录 - * @param registry - */ - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/**") - .addResourceLocations("classpath:/resources/") - .addResourceLocations("classpath:/static/") - .addResourceLocations("classpath:/public/"); - super.addResourceHandlers(registry); - } } -- GitLab