mirror of
https://github.com/kekingcn/kkFileView.git
synced 2026-03-30 01:56:36 +00:00
28 lines
1008 B
Java
28 lines
1008 B
Java
package cn.keking.config;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
|
/**
|
|
* @author: chenjh
|
|
* @since: 2019/4/16 20:04
|
|
*/
|
|
@Configuration
|
|
public class WebConfig extends WebMvcConfigurerAdapter {
|
|
|
|
private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class);
|
|
/**
|
|
* 访问外部文件配置
|
|
*/
|
|
@Override
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
String filePath = ConfigConstants.getFileDir();
|
|
LOGGER.info("Add resource locations: {}", filePath);
|
|
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath);
|
|
super.addResourceHandlers(registry);
|
|
}
|
|
}
|