From 5f84becf084d500559ab332e577fa407da367dea Mon Sep 17 00:00:00 2001 From: zhaojun <873019219@qq.com> Date: Sat, 26 Nov 2022 17:58:50 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BC=98=E5=8C=96=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=BA=90=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=20name=20=E7=9A=84=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E4=BB=A5=E4=BE=BF=E6=9B=B4=E5=85=A8=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/context/StorageSourceContext.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/im/zhaojun/zfile/module/storage/context/StorageSourceContext.java b/src/main/java/im/zhaojun/zfile/module/storage/context/StorageSourceContext.java index f80ff01..ad6642f 100644 --- a/src/main/java/im/zhaojun/zfile/module/storage/context/StorageSourceContext.java +++ b/src/main/java/im/zhaojun/zfile/module/storage/context/StorageSourceContext.java @@ -84,8 +84,8 @@ public class StorageSourceContext implements ApplicationContextAware { List list = storageSourceService.findAllOrderByOrderNum(); for (StorageSource storageSource : list) { try { - init(storageSource.getId()); - log.info("启动时初始化存储源成功, 存储源 id: {}, 存储源类型: {}, 存储源名称: {}", + init(storageSource); + log.info("启动时初始化存储源成功, 存储源 id: [{}], 存储源类型: [{}], 存储源名称: [{}]", storageSource.getId(), storageSource.getType().getDescription(), storageSource.getName()); } catch (Exception e) { log.error("启动时初始化存储源失败, 存储源 id: {}, 存储源类型: {}, 存储源名称: {}", @@ -152,10 +152,13 @@ public class StorageSourceContext implements ApplicationContextAware { /** * 初始化指定存储源的 Service, 添加到上下文环境中. * - * @param storageId - * 存储源 ID. + * @param storageSource + * 存储源对象 */ - public void init(Integer storageId) { + public void init(StorageSource storageSource) { + Integer storageId = storageSource.getId(); + String storageName = storageSource.getName(); + AbstractBaseFileService baseFileService = getInitStorageBeanByStorageId(storageId); if (baseFileService == null) { throw new InvalidStorageSourceException(storageId); @@ -163,6 +166,7 @@ public class StorageSourceContext implements ApplicationContextAware { // 填充初始化参数 baseFileService.setStorageId(storageId); + baseFileService.setName(storageName); IStorageParam initParam = getInitParam(storageId, baseFileService); baseFileService.setParam(initParam);