修改文件下载,新增静态文件缓存

This commit is contained in:
wenc000 2019-08-26 15:01:11 +08:00
parent fe74fb7d72
commit 4acdf5ffaa
2 changed files with 2 additions and 1 deletions

View File

@ -141,7 +141,6 @@ public class FileServiceImpl extends AbstractService implements IFileService {
outputStream.flush();
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new SearchException("文件获取失败");
} finally {
try {
if (null != outputStream) {
@ -153,6 +152,7 @@ public class FileServiceImpl extends AbstractService implements IFileService {
} catch (Exception e1) {
LOG.error(e1.getMessage(), e1);
}
throw new SearchException("文件获取失败");
}
}

View File

@ -28,5 +28,6 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/files/**").addResourceLocations("file:" + fileProperties.getUploadPath());
registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/static/assets/").setCachePeriod(7 * 24 * 3600);
}
}