提交 0aaa4d74 编写于 作者: zlt2000's avatar zlt2000

修改DefaultWebMvcConfig类由WebMvcConfigurationSupport改为WebMvcConfigurer,避免覆盖其他的WebMvc配置

上级 9fee5f23
......@@ -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
* <p>
* 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);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册