38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
|
|
package com.dpkj.common.config;
|
||
|
|
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* mvcConfig配置类
|
||
|
|
*
|
||
|
|
* @author <a href="https://gitee.com/shi-chongli">石头人</a>
|
||
|
|
* @since 2023-05-23 15:24:43
|
||
|
|
*/
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@Configuration
|
||
|
|
public class MvcConfig extends WebMvcConfigurationSupport {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 添加资源过滤处理器
|
||
|
|
* @param registry 资源处理器
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||
|
|
registry.addResourceHandler("/**")
|
||
|
|
.addResourceLocations("classpath:/static/");
|
||
|
|
registry.addResourceHandler("/swagger-ui.html/**")
|
||
|
|
.addResourceLocations("classpath:/META-INF/resources/");
|
||
|
|
registry.addResourceHandler("/webjars/**")
|
||
|
|
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||
|
|
registry.addResourceHandler("/swagger-ui/**")
|
||
|
|
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
||
|
|
.resourceChain(false);
|
||
|
|
|
||
|
|
super.addResourceHandlers(registry);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|