提交 1925498e authored 作者: taojinlong's avatar taojinlong

fix: 插件卸载

上级 586f4b03
......@@ -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);
......
......@@ -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;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论