diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java index 97934db..24f774f 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java @@ -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("文件获取失败"); } } diff --git a/cloud-common/src/main/java/com/cm/common/config/WebConfig.java b/cloud-common/src/main/java/com/cm/common/config/WebConfig.java index 98a6c0a..8136097 100644 --- a/cloud-common/src/main/java/com/cm/common/config/WebConfig.java +++ b/cloud-common/src/main/java/com/cm/common/config/WebConfig.java @@ -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); } }