From 1925498e992f1bee01a27233069fd22ec63be341 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Sun, 8 May 2022 13:57:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E5=8D=B8=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/plugins/config/LoadjarUtil.java | 3 +-- .../main/java/io/dataease/service/sys/PluginService.java | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/config/LoadjarUtil.java b/backend/src/main/java/io/dataease/plugins/config/LoadjarUtil.java index 170d5d1feb..a0e0745a18 100644 --- a/backend/src/main/java/io/dataease/plugins/config/LoadjarUtil.java +++ b/backend/src/main/java/io/dataease/plugins/config/LoadjarUtil.java @@ -26,8 +26,7 @@ public class LoadjarUtil { public List loadJar(String jarPath, MyPlugin myPlugin) throws Exception{ File jar = new File(jarPath); URI uri = jar.toURI(); - String moduleName = jarPath.substring(jarPath.lastIndexOf("/")+1,jarPath.lastIndexOf(".")); - + String moduleName = myPlugin.getModuleName() + "-" + myPlugin.getVersion(); if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){ ClassloaderResponsity.getInstance().removeClassLoader(moduleName); diff --git a/backend/src/main/java/io/dataease/service/sys/PluginService.java b/backend/src/main/java/io/dataease/service/sys/PluginService.java index b00d73dc5d..2fa937a64e 100644 --- a/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -139,7 +139,7 @@ public class PluginService { CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); } catch (Exception e) { if (StringUtils.isNotEmpty(targetDir)) { - DeFileUtils.deleteFile(targetDir); + deleteJarFile(myPlugin); } LogUtil.error(e.getMessage(), e); DEException.throwException(e); @@ -199,9 +199,7 @@ public class PluginService { if(CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))){ throw new RuntimeException(Translator.get("i18n_plugin_not_allow_delete")); } - SpringContextUtil.getBeanFactory().removeBeanDefinition(myPlugin.getDsType() + "DsProvider"); - SpringContextUtil.getBeanFactory().removeBeanDefinition(myPlugin.getDsType() + "QueryProvider"); - SpringContextUtil.getBeanFactory().removeBeanDefinition(myPlugin.getDsType() + "Service"); + loadjarUtil.deleteModule(myPlugin.getModuleName() + "-" + myPlugin.getVersion()); } myPluginMapper.deleteByPrimaryKey(pluginId); return true;