修改DefaultWebMvcConfig类由WebMvcConfigurationSupport改为WebMvcConfigurer,避免覆盖其他的WebMvc配置
This commit is contained in:
+5
-16
@@ -6,8 +6,7 @@ import com.central.common.resolver.TokenArgumentResolver;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -16,8 +15,11 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author zlt
|
* @author zlt
|
||||||
* @date 2019/8/5
|
* @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
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@@ -34,17 +36,4 @@ public class DefaultWebMvcConfig extends WebMvcConfigurationSupport {
|
|||||||
//注入应用信息
|
//注入应用信息
|
||||||
argumentResolvers.add(new ClientArgumentResolver());
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user