From db5330d2e249a7cdb82108de514954f9f0d32a24 Mon Sep 17 00:00:00 2001 From: StarBlues Date: Wed, 11 Dec 2019 15:21:48 +0800 Subject: [PATCH 1/5] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3ConfigBean=E5=AD=90?= =?UTF-8?q?=E7=B1=BB=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E5=8D=B8=E8=BD=BD=E6=8F=92=E4=BB=B6=E7=9A=84bug=202.=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9C=A8=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E4=B8=8B?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=AE=89=E8=A3=85jar=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resolver/ResourceWebMvcConfigurer.java | 2 + .../extension/AbstractExtension.java | 15 ++++--- .../starblues/factory/SpringBeanRegister.java | 6 +-- .../pipe/bean/ConfigBeanProcessor.java | 38 ++++++++++------ .../operator/DefaultPluginOperator.java | 43 +++++++++++++------ .../operator/module/PluginInfo.java | 16 ++++++- .../integration/user/PluginUser.java | 6 ++- 7 files changed, 88 insertions(+), 38 deletions(-) diff --git a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/src/main/java/com/gitee/starblues/extension/resources/resolver/ResourceWebMvcConfigurer.java b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/src/main/java/com/gitee/starblues/extension/resources/resolver/ResourceWebMvcConfigurer.java index 8c1f91e..2c07742 100644 --- a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/src/main/java/com/gitee/starblues/extension/resources/resolver/ResourceWebMvcConfigurer.java +++ b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/src/main/java/com/gitee/starblues/extension/resources/resolver/ResourceWebMvcConfigurer.java @@ -26,6 +26,8 @@ public class ResourceWebMvcConfigurer implements WebMvcConfigurer { CacheControl cacheControl = StaticResourceExtension.getPluginStaticResourcesCacheControl(); if(cacheControl != null){ resourceHandlerRegistration.setCacheControl(cacheControl); + } else { + resourceHandlerRegistration.setCacheControl(CacheControl.noStore()); } resourceHandlerRegistration .resourceChain(false) diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java index 781bf32..9d24c16 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java @@ -25,13 +25,14 @@ public abstract class AbstractExtension { } /** - * 扩展key + * 扩展唯一的key * @return String */ public abstract String key(); /** * 该扩展初始化的操作 + * 主要是在插件初始化阶段被调用 * @throws Exception 初始化异常 */ public void initialize(ApplicationContext applicationContext) throws Exception{ @@ -39,7 +40,8 @@ public abstract class AbstractExtension { /** - * 得到插件的资源加载者 + * 返回插件的资源加载者。 + * 主要是加载插件中的某些资源,比如文件、图片等。 * @return List PluginResourceLoader */ public List getPluginResourceLoader(){ @@ -47,7 +49,8 @@ public abstract class AbstractExtension { } /** - * 得到扩展的插件中的类分组器 + * 返回扩展的插件中的类分组器。 + * 该扩展主要是对插件中的Class文件分组,然后供 PluginPipeProcessor、PluginPostProcessor 阶段使用。 * @param applicationContext 主程序ApplicationContext * @return List PluginPipeProcessorExtend */ @@ -57,7 +60,8 @@ public abstract class AbstractExtension { /** - * 得到扩展的流插件处理者 + * 返回扩展的流插件处理者。 + * 该扩展主要是对每一个插件进行处理 * @param applicationContext 主程序ApplicationContext * @return List PluginPipeProcessorExtend */ @@ -66,7 +70,8 @@ public abstract class AbstractExtension { } /** - * 得到扩展的插件后置处理者 + * 返回扩展的插件后置处理者。 + * 该扩展主要是对全部插件进行处理。 * @param applicationContext 主程序ApplicationContext * @return List PluginPostProcessorExtend */ diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/SpringBeanRegister.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/SpringBeanRegister.java index 0a3c2ba..7eec53e 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/SpringBeanRegister.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/SpringBeanRegister.java @@ -79,8 +79,8 @@ public class SpringBeanRegister { if(PluginInfoContainer.existRegisterBeanName((beanName))){ String error = MessageFormat.format("Bean name {0} already exist of {1}", beanName, aClass.getName()); - logger.error(error); - return null; + logger.debug(error); + return beanName; } if(consumer != null){ consumer.accept(beanDefinition); @@ -133,8 +133,8 @@ public class SpringBeanRegister { * @param beanName bean名称 */ public void unregister(String pluginId, String beanName){ - applicationContext.removeBeanDefinition(beanName); PluginInfoContainer.removeRegisterBeanName(pluginId, beanName); + applicationContext.removeBeanDefinition(beanName); } diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/pipe/bean/ConfigBeanProcessor.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/pipe/bean/ConfigBeanProcessor.java index 802b30d..17dbebb 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/pipe/bean/ConfigBeanProcessor.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/pipe/bean/ConfigBeanProcessor.java @@ -5,11 +5,11 @@ import com.gitee.starblues.factory.SpringBeanRegister; import com.gitee.starblues.factory.process.pipe.PluginPipeProcessor; import com.gitee.starblues.factory.process.pipe.classs.group.ConfigBeanGroup; import com.gitee.starblues.realize.ConfigBean; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * 插件中实现 ConfigBean 接口的的处理者 @@ -20,6 +20,8 @@ import java.util.Set; */ public class ConfigBeanProcessor implements PluginPipeProcessor { + private final Logger log = LoggerFactory.getLogger(this.getClass()); + private static final String KEY = "ConfigBeanProcessor"; private final SpringBeanRegister springBeanRegister; @@ -44,33 +46,41 @@ public class ConfigBeanProcessor implements PluginPipeProcessor { return; } String pluginId = pluginRegistryInfo.getPluginWrapper().getPluginId(); - Set beanNames = new HashSet<>(); + Map configBeanMap = new HashMap<>(); for (Class aClass : configBeans) { if(aClass == null){ continue; } String name = springBeanRegister.register(pluginId, aClass); - beanNames.add(name); Object bean = applicationContext.getBean(name); if(bean instanceof ConfigBean){ - ((ConfigBean)bean).initialize(); + ConfigBean configBean = (ConfigBean) bean; + configBean.initialize(); + configBeanMap.put(name, configBean); } } - pluginRegistryInfo.addProcessorInfo(KEY, beanNames); + pluginRegistryInfo.addProcessorInfo(KEY, configBeanMap); } @Override public void unRegistry(PluginRegistryInfo pluginRegistryInfo) throws Exception { - Set beanNames = pluginRegistryInfo.getProcessorInfo(KEY); - if(beanNames == null){ + Map configBeanMap = pluginRegistryInfo.getProcessorInfo(KEY); + if(configBeanMap == null){ return; } - for (String beanName : beanNames) { - Object bean = applicationContext.getBean(beanName); - if(bean instanceof ConfigBean){ - ((ConfigBean)bean).destroy(); + String pluginId = pluginRegistryInfo.getPluginWrapper().getPluginId(); + configBeanMap.forEach((beanName, configBean)->{ + if(configBean == null){ + return; } - } + try { + configBean.destroy(); + } catch (Exception e) { + log.error("ConfigBean '' destroy exception. {}", e.getMessage(), e); + } + springBeanRegister.unregister(pluginId, beanName); + }); + } diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java index 54a008a..449f229 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java @@ -131,6 +131,9 @@ public class DefaultPluginOperator implements PluginOperator { @Override public boolean install(Path path) throws Exception { + if(isDev()){ + throw new RuntimeException("Plugin cannot be installed in 'dev' environment"); + } if(path == null){ throw new IllegalArgumentException("Method:install param 'pluginId' can not be empty"); } @@ -199,19 +202,19 @@ public class DefaultPluginOperator implements PluginOperator { if(pluginWrapper == null){ throw new Exception("Plugin uninstall failure, Not found plugin '" + pluginId + "'"); } - if(pluginWrapper.getPluginState() != PluginState.STARTED){ - throw new Exception("This plugin '" + pluginId + "' is not started"); - } + Exception exception = null; - try { - pluginFactory.unRegistry(pluginId); - pluginFactory.build(); - } catch (Exception e){ - log.error("Plugin '{}' uninstall failure, {}", pluginId, e.getMessage()); - exception = e; + if(pluginWrapper.getPluginState() == PluginState.STARTED){ + try { + pluginFactory.unRegistry(pluginId); + pluginFactory.build(); + } catch (Exception e){ + log.error("Plugin '{}' uninstall failure, {}", pluginId, e.getMessage()); + exception = e; + } } - try { + try { if (pluginManager.unloadPlugin(pluginId)) { Path pluginPath = pluginWrapper.getPluginPath(); if(isBackup){ @@ -301,6 +304,9 @@ public class DefaultPluginOperator implements PluginOperator { @Override public boolean uploadPluginAndStart(MultipartFile pluginFile) throws Exception { + if(isDev()){ + throw new RuntimeException("Plugin cannot be installed in the 'dev' environment"); + } if(pluginFile == null){ throw new IllegalArgumentException("Method:uploadPluginAndStart param 'pluginFile' can not be null"); } @@ -372,20 +378,31 @@ public class DefaultPluginOperator implements PluginOperator { return startedPlugins.stream() .filter(pluginWrapper -> pluginWrapper != null) .map(pw -> { - return new PluginInfo(pw.getDescriptor(), pw.getPluginState(), - pw.getPluginPath().toAbsolutePath().toString()); + return getPluginInfo(pw); }) .collect(Collectors.toList()); } + + @Override public PluginInfo getPluginInfo(String pluginId) { PluginWrapper pluginWrapper = pluginManager.getPlugin(pluginId); if(pluginWrapper == null){ throw new RuntimeException("Not found plugin '" + pluginId + "'"); } + return getPluginInfo(pluginWrapper); + } + + /** + * 通过PluginWrapper得到插件信息 + * @param pluginWrapper pluginWrapper + * @return PluginInfo + */ + private PluginInfo getPluginInfo(PluginWrapper pluginWrapper) { return new PluginInfo(pluginWrapper.getDescriptor(), pluginWrapper.getPluginState(), - pluginWrapper.getPluginPath().toAbsolutePath().toString()); + pluginWrapper.getPluginPath().toAbsolutePath().toString(), + pluginManager.getRuntimeMode().toString()); } diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/module/PluginInfo.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/module/PluginInfo.java index ae08b02..c383001 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/module/PluginInfo.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/module/PluginInfo.java @@ -26,10 +26,20 @@ public class PluginInfo { */ private String path; - public PluginInfo(PluginDescriptor pluginDescriptor, PluginState pluginState, String path) { + /** + * 允许模式 + */ + private String runMode; + + + public PluginInfo(PluginDescriptor pluginDescriptor, + PluginState pluginState, + String path, + String runMode) { this.pluginDescriptor = pluginDescriptor; this.pluginState = pluginState; this.path = path; + this.runMode = runMode; } public PluginDescriptor getPluginDescriptor() { @@ -47,4 +57,8 @@ public class PluginInfo { public String getPath() { return path; } + + public String getRunMode() { + return runMode; + } } diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/PluginUser.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/PluginUser.java index 5542b4e..8caec98 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/PluginUser.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/PluginUser.java @@ -86,9 +86,11 @@ public interface PluginUser { */ List getPluginBeans(String pluginId, Class aClass); + /** - * 生成一个新的实例 - * @param object 元实例对象 + * 生成一个新的Spring实例Bean. + * 使用场景:主要用于非单例对象的生成。 + * @param object 旧实例对象 * @param 实例泛型 * @return 新实例对象 */ -- Gitee From b7915f5ba4b3fc768056ec85720c3c059f7fcb42 Mon Sep 17 00:00:00 2001 From: StarBlues Date: Wed, 18 Dec 2019 17:22:14 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=9C=A8'basic-example'=E6=A1=88=E4=BE=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=AD=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E5=8F=AF=E6=89=A9=E5=B1=95quartz=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic-example/basic-example-main/pom.xml | 7 + .../example/main/config/CommonBeanConfig.java | 22 +++ .../example/main/config/PluginBeanConfig.java | 2 + .../basic/example/main/quartz/QuartzJob.java | 63 +++++++ .../example/main/quartz/QuartzJobManager.java | 155 ++++++++++++++++++ .../example/plugin1/config/PluginConfig1.java | 25 ++- .../example/plugin1/job/Plugin1QuartzJob.java | 84 ++++++++++ .../src/main/resources/plugin1.yml | 2 + 8 files changed, 358 insertions(+), 2 deletions(-) create mode 100644 example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/CommonBeanConfig.java create mode 100644 example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJob.java create mode 100644 example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJobManager.java create mode 100644 example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/job/Plugin1QuartzJob.java diff --git a/example/basic-example/basic-example-main/pom.xml b/example/basic-example/basic-example-main/pom.xml index 8ae868c..cadafe3 100644 --- a/example/basic-example/basic-example-main/pom.xml +++ b/example/basic-example/basic-example-main/pom.xml @@ -18,6 +18,7 @@ 2.7.0 + 2.3.2 1.6 2.2.2-RELEASE @@ -39,6 +40,12 @@ spring-boot-starter-web + + org.quartz-scheduler + quartz + ${quartz.version} + + io.springfox diff --git a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/CommonBeanConfig.java b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/CommonBeanConfig.java new file mode 100644 index 0000000..767b47f --- /dev/null +++ b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/CommonBeanConfig.java @@ -0,0 +1,22 @@ +package com.basic.example.main.config; + +import org.quartz.SchedulerFactory; +import org.quartz.impl.StdSchedulerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 公用bean的配置 + * + * @author zhangzhuo + * @version 1.0 + */ +@Configuration +public class CommonBeanConfig { + + @Bean + public SchedulerFactory schedulerFactory(){ + return new StdSchedulerFactory(); + } + +} diff --git a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java index ab802c0..411cff1 100644 --- a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java +++ b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java @@ -1,5 +1,6 @@ package com.basic.example.main.config; +import com.basic.example.main.quartz.QuartzJobManager; import com.gitee.starblues.integration.application.DefaultPluginApplication; import com.gitee.starblues.integration.application.PluginApplication; import com.gitee.starblues.integration.application.AutoPluginApplication; @@ -26,6 +27,7 @@ public class PluginBeanConfig { AutoPluginApplication autoPluginApplication = new AutoPluginApplication(); autoPluginApplication.setPluginInitializerListener(pluginListener); autoPluginApplication.addListener(ExamplePluginListener.class); + autoPluginApplication.addListener(QuartzJobManager.class); return autoPluginApplication; } diff --git a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJob.java b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJob.java new file mode 100644 index 0000000..6b61684 --- /dev/null +++ b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJob.java @@ -0,0 +1,63 @@ +package com.basic.example.main.quartz; + +import org.quartz.Job; + +import java.util.Map; + +/** + * Quartz框架job定义的统一接口 + * + * @author zhangzhuo + * @version 1.0 + */ +public interface QuartzJob { + + /** + * 是否启用 + * @return true 启用。false 禁用 + */ + boolean enable(); + + + /** + * job 名称 + * @return String + */ + String jobName(); + + /** + * 触发器名称 + * @return String + */ + String triggerName(); + + /** + * cron 表达式 + * @return cron 表达式 + */ + String cron(); + + /** + * 延迟执行秒数 + * @return 秒数 + */ + int delaySeconds(); + + + /** + * job 执行类型 + * @return Job 实现类 + */ + ClassjobClass(); + + + /** + * 传入到job中的数据 + * @return Map + */ + Map jobData(); + + + + +} diff --git a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJobManager.java b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJobManager.java new file mode 100644 index 0000000..30ef1a8 --- /dev/null +++ b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/quartz/QuartzJobManager.java @@ -0,0 +1,155 @@ +package com.basic.example.main.quartz; + +import com.gitee.starblues.integration.application.PluginApplication; +import com.gitee.starblues.integration.listener.PluginListener; +import org.quartz.*; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; + +/** + * QuartzJob 管理器 + * + * @author zhangzhuo + * @version 1.0 + */ +public class QuartzJobManager implements PluginListener { + + private final static String TRIGGER_GROUP = "QuartzTriggerGroup"; + private final static String JOB_GROUP = "QuartzJobGroup"; + + + private final Scheduler scheduler; + private final PluginApplication pluginApplication; + + /** + * 缓存启动的job. 用于停止时使用 + */ + private final Map> startJobMap = new HashMap<>(); + + + public QuartzJobManager(SchedulerFactory schedulerFactory, + PluginApplication pluginApplication) throws SchedulerException { + this.scheduler = schedulerFactory.getScheduler(); + this.pluginApplication = pluginApplication; + } + + + @Override + public void registry(String pluginId) { + List quartzJobs = pluginApplication.getPluginUser().getPluginBeans(pluginId, QuartzJob.class); + if(quartzJobs == null || quartzJobs.isEmpty()){ + return; + } + for (QuartzJob quartzJob : quartzJobs) { + try { + if(startJob(quartzJob)){ + List quartzJobsList = startJobMap.get(pluginId); + if(quartzJobsList == null){ + quartzJobsList = new ArrayList<>(); + startJobMap.put(pluginId, quartzJobsList); + } + quartzJobsList.add(quartzJob); + } + } catch (SchedulerException e) { + e.printStackTrace(); + } + } + } + + @Override + public void unRegistry(String pluginId) { + List quartzJobs = startJobMap.remove(pluginId); + if(quartzJobs == null){ + return; + } + for (QuartzJob quartzJob : quartzJobs) { + try { + stopJob(quartzJob); + } catch (SchedulerException e) { + e.printStackTrace(); + } + } + } + + @Override + public void failure(String pluginId, Throwable throwable) { + + } + + /** + * 启动job + * @param quartzJob job接口 + */ + private boolean startJob(QuartzJob quartzJob) throws SchedulerException { + if(quartzJob == null){ + return false; + } + if(!quartzJob.enable()){ + // 不启用 + return false; + } + JobBuilder jobBuilder = JobBuilder.newJob(quartzJob.jobClass()) + .withIdentity(quartzJob.jobName(), JOB_GROUP); + Map jobData = quartzJob.jobData(); + if(jobData != null){ + jobBuilder.setJobData(new JobDataMap(jobData)); + } + JobDetail jobDetail = jobBuilder.build(); + Trigger trigger = configTrigger(quartzJob); + scheduler.scheduleJob(jobDetail, trigger); + synchronized (scheduler) { + if (!scheduler.isStarted()) { + scheduler.start(); + } + } + return true; + } + + + /** + * 停止job + * @param quartzJob job接口 + */ + private void stopJob(QuartzJob quartzJob) throws SchedulerException { + + String jobName = quartzJob.jobName(); + String triggerName = quartzJob.triggerName(); + + // 停止触发器 + scheduler.pauseTrigger(TriggerKey.triggerKey(triggerName, TRIGGER_GROUP)); + // 停止任务 + scheduler.pauseJob(JobKey.jobKey(jobName, JOB_GROUP)); + + // 停止该触发器的任务 + scheduler.unscheduleJob(TriggerKey.triggerKey(triggerName, TRIGGER_GROUP)); + // 删除任务 + scheduler.deleteJob(JobKey.jobKey(jobName, JOB_GROUP)); + } + + + /** + * 配置触发器 + * @param quartzJob quartzJob + * @return 触发器 + */ + private Trigger configTrigger(QuartzJob quartzJob) { + //0 56 09 ? * * + TriggerBuilder triggerBuilder = TriggerBuilder.newTrigger() + .withIdentity(quartzJob.triggerName(), TRIGGER_GROUP) + .withSchedule(CronScheduleBuilder.cronSchedule(quartzJob.cron())); + + int delaySeconds = quartzJob.delaySeconds(); + if(delaySeconds <= 0L){ + triggerBuilder.startNow(); + } else { + LocalDateTime localDateTime = LocalDateTime.now(); + localDateTime = localDateTime.plusSeconds(60); + Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + triggerBuilder.startAt(date); + } + return triggerBuilder.build(); + } + +} diff --git a/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/config/PluginConfig1.java b/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/config/PluginConfig1.java index bd964e3..efd5be3 100644 --- a/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/config/PluginConfig1.java +++ b/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/config/PluginConfig1.java @@ -16,6 +16,8 @@ public class PluginConfig1 { private String name; private String plugin; + private Boolean jobEnable; + private String jobCron; private Set setString; private List listInteger; @@ -25,7 +27,6 @@ public class PluginConfig1 { - public String getName() { return name; } @@ -42,6 +43,22 @@ public class PluginConfig1 { this.plugin = plugin; } + public Boolean getJobEnable() { + return jobEnable; + } + + public void setJobEnable(Boolean jobEnable) { + this.jobEnable = jobEnable; + } + + public String getJobCron() { + return jobCron; + } + + public void setJobCron(String jobCron) { + this.jobCron = jobCron; + } + public Set getSetString() { return setString; } @@ -76,13 +93,17 @@ public class PluginConfig1 { @Override public String toString() { - return "BasePluginExtension{" + + return "PluginConfig1{" + "name='" + name + '\'' + ", plugin='" + plugin + '\'' + + ", jobEnable=" + jobEnable + + ", jobCron='" + jobCron + '\'' + ", setString=" + setString + ", listInteger=" + listInteger + ", defaultValue='" + defaultValue + '\'' + + ", subConfig=" + subConfig + '}'; } + } diff --git a/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/job/Plugin1QuartzJob.java b/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/job/Plugin1QuartzJob.java new file mode 100644 index 0000000..d0781ed --- /dev/null +++ b/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/job/Plugin1QuartzJob.java @@ -0,0 +1,84 @@ +package com.basic.example.plugin1.job; + +import com.basic.example.main.quartz.QuartzJob; +import com.basic.example.plugin1.config.PluginConfig1; +import org.quartz.Job; +import org.quartz.JobDataMap; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + * 插件1 job + * + * @author zhangzhuo + * @version 1.0 + */ +@Component +public class Plugin1QuartzJob implements QuartzJob { + + + + private static final String JOB_NAME = "plugin-job"; + private static final String TRIGGER_NAME = "plugin-trigger"; + + private final PluginConfig1 pluginConfig1; + + public Plugin1QuartzJob(PluginConfig1 pluginConfig1) { + this.pluginConfig1 = pluginConfig1; + } + + + @Override + public boolean enable() { + return pluginConfig1.getJobEnable(); + } + + @Override + public String jobName() { + return JOB_NAME; + } + + @Override + public String triggerName() { + return TRIGGER_NAME; + } + + @Override + public String cron() { + return pluginConfig1.getJobCron(); + } + + @Override + public int delaySeconds() { + return 0; + } + + @Override + public Class jobClass() { + return JobImpl.class; + } + + @Override + public Map jobData() { + Map jobData = new HashMap<>(); + jobData.put(JOB_NAME, JOB_NAME); + return jobData; + } + + + + public static class JobImpl implements Job{ + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); + String string = jobDataMap.getString(JOB_NAME); + System.out.println("plugin1 job start = " + string); + } + } + +} diff --git a/example/basic-example/plugins/basic-example-plugin1/src/main/resources/plugin1.yml b/example/basic-example/plugins/basic-example-plugin1/src/main/resources/plugin1.yml index 9da193a..8f851e4 100644 --- a/example/basic-example/plugins/basic-example-plugin1/src/main/resources/plugin1.yml +++ b/example/basic-example/plugins/basic-example-plugin1/src/main/resources/plugin1.yml @@ -1,5 +1,7 @@ name: plugin1 plugin: examplePlugin1 +jobEnable: true +jobCron: "*/5 * * * * ?" setString: - set1 - set2 -- Gitee From 1febfe85790960f0fbf51bff584a08ac11b8fc74 Mon Sep 17 00:00:00 2001 From: lxbzmy Date: Mon, 16 Mar 2020 20:15:53 +0800 Subject: [PATCH 3/5] =?UTF-8?q?type=20cast=20exception.=20=E8=BF=99?= =?UTF-8?q?=E4=B8=AA=E5=9C=B0=E6=96=B9=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84?= =?UTF-8?q?=E3=80=82=201.=20=E5=A6=82=E6=9E=9C=E6=96=B9=E6=B3=95=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E9=83=BD=E6=98=AFList=E6=8E=A5=E5=8F=A3=E5=9E=8B?= =?UTF-8?q?=EF=BC=8Cjava.util.List=20!=3D=20java.util.ArrayList;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2. method.getReturnType() 没有泛型的参数类型,需要使用getGenericReturnType map.readValue(json, map.getTypeFactory().constructType(methods.getGenericReturnType())); --- .../factory/process/post/bean/PluginInvokePostProcessor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java index 2afd559..9a11caa 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java @@ -288,11 +288,11 @@ public class PluginInvokePostProcessor implements PluginPostProcessor { return null; } Class returnType = method.getReturnType(); - if(returnType == invokeReturn.getClass()){ + if(ClassUtils.isAssignable(invokeReturn.getClass(),returnType)){ return invokeReturn; } else { String json = OBJECT_MAPPER.writeValueAsString(invokeReturn); - return OBJECT_MAPPER.readValue(json, returnType); + return OBJECT_MAPPER.readValue(json, OBJECT_MAPPER.getTypeFactory().constructType(method.getGenericReturnType()) ); } } -- Gitee From f8243abe730bf02ca5d8a541d6f063e2bd459307 Mon Sep 17 00:00:00 2001 From: StarBlues Date: Wed, 25 Mar 2020 17:39:54 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8linux/mac?= =?UTF-8?q?=E4=B8=8B=E6=89=AB=E6=8F=8F=E7=B1=BB=E5=90=8D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/main/config/PluginBeanConfig.java | 5 +- example/basic-example/package.bat | 1 - .../com/mybatis/main/rest/PluginResource.java | 8 +- .../mybatis/plugin1/rest/UserController.java | 9 +- .../com/gitee/starblues/utils/ScanUtils.java | 82 ++++++++++++++++--- 5 files changed, 80 insertions(+), 25 deletions(-) diff --git a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java index 411cff1..343c9b3 100644 --- a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java +++ b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/config/PluginBeanConfig.java @@ -4,6 +4,7 @@ import com.basic.example.main.quartz.QuartzJobManager; import com.gitee.starblues.integration.application.DefaultPluginApplication; import com.gitee.starblues.integration.application.PluginApplication; import com.gitee.starblues.integration.application.AutoPluginApplication; +import org.quartz.SchedulerFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -23,11 +24,11 @@ public class PluginBeanConfig { * @return PluginApplication */ @Bean - public PluginApplication pluginApplication(PluginListener pluginListener){ + public PluginApplication pluginApplication(PluginListener pluginListener, + SchedulerFactory schedulerFactory){ AutoPluginApplication autoPluginApplication = new AutoPluginApplication(); autoPluginApplication.setPluginInitializerListener(pluginListener); autoPluginApplication.addListener(ExamplePluginListener.class); - autoPluginApplication.addListener(QuartzJobManager.class); return autoPluginApplication; } diff --git a/example/basic-example/package.bat b/example/basic-example/package.bat index 4be1bfe..1d57fb2 100644 --- a/example/basic-example/package.bat +++ b/example/basic-example/package.bat @@ -27,4 +27,3 @@ cd dist REM run main rename basic-example-main-*-exec.jar basic-example-start.jar rename application-prod.yml application.yml -java -jar basic-example-start.jar --spring.config.location=application.yml \ No newline at end of file diff --git a/example/integration-mybatis/integration-mybatis-main/src/main/java/com/mybatis/main/rest/PluginResource.java b/example/integration-mybatis/integration-mybatis-main/src/main/java/com/mybatis/main/rest/PluginResource.java index b31c699..9e93fd5 100644 --- a/example/integration-mybatis/integration-mybatis-main/src/main/java/com/mybatis/main/rest/PluginResource.java +++ b/example/integration-mybatis/integration-mybatis-main/src/main/java/com/mybatis/main/rest/PluginResource.java @@ -103,9 +103,13 @@ public class PluginResource { * @return 返回操作结果 */ @PostMapping("/uninstall/{id}") - public String uninstall(@PathVariable("id") String id){ + public String uninstall(@PathVariable("id") String id, + @RequestParam(value = "isBack", required = false) Boolean isBack){ try { - if(pluginOperator.uninstall(id, true)){ + if(isBack == null){ + isBack = true; + } + if(pluginOperator.uninstall(id, isBack)){ return "plugin '" + id +"' uninstall success"; } else { return "plugin '" + id +"' uninstall failure"; diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/UserController.java b/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/UserController.java index 35e12e4..2878eee 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/UserController.java +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/UserController.java @@ -4,11 +4,9 @@ import com.mybatis.main.entity.User; import com.mybatis.main.mapper.UserMapper; import com.mybatis.main.service.TestTestTransactional; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -40,9 +38,6 @@ public class UserController { return userMapper.getById(id); } - - - @GetMapping("/transactional") public void testTestTransactional(){ testTestTransactional.transactional(); diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/utils/ScanUtils.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/utils/ScanUtils.java index d30a55f..77d2b8b 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/utils/ScanUtils.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/utils/ScanUtils.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.net.JarURLConnection; import java.net.URL; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Enumeration; import java.util.HashSet; @@ -16,6 +17,7 @@ import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * 扫描工具类 @@ -29,26 +31,61 @@ public class ScanUtils { * 扫描指定包中的类。包括子包中的类 * * @param basePackage 包名 - * @param baseClass 当前操作的基础类 - * @return 类全路径 + * @param baseClass 当前操作的基础类 + * @return 类全路径(形如:xx.bb.cc) * @throws IOException 扫描异常 */ public static Set scanClassPackageName(String basePackage, Class baseClass) throws IOException { + String osName = System.getProperty("os.name"); + if (osName.startsWith("Windows")) { + // windows + return scanClassPackageNameOfWindows(basePackage, baseClass); + } else { + // unix or linux + return scanClassPackageNameOfOther(basePackage, baseClass); + } + } + + /** + * 扫描windows环境下的类。包括子包中的类 + * @param basePackage 包名 + * @param baseClass 当前操作的基础类 + * @return 类全路径(形如:xx.bb.cc) + * @throws IOException 扫描异常 + */ + private static Set scanClassPackageNameOfWindows(String basePackage, Class baseClass) throws IOException { + String classpathRootPath = baseClass.getResource("/").getPath(); + final String classpath = classpathRootPath + .replace("/","\\") + .replaceFirst("\\\\",""); + // 把包名 packageName 转换为路径名 + basePackage = basePackage.replace(".", File.separator); + // class 文件全路径 + String fullPath = classpath + basePackage; + + return filterPath(fullPath).map(path -> { + String pathString = path.toString(); + return pathString + .replace(classpath, "") + .replace("\\",".") + .replace(".class",""); + }).collect(Collectors.toSet()); + } + + + /** + * 扫描linux/unix/mac环境下的类。包括子包中的类 + * @param basePackage 包名 + * @param baseClass 当前操作的基础类 + * @return 类全路径(形如:xx.bb.cc) + * @throws IOException 扫描异常 + */ + private static Set scanClassPackageNameOfOther(String basePackage, Class baseClass) throws IOException { final String classpath = baseClass.getResource("/").getPath(); // class 文件全路径 String fullPath = classpath + ClassUtils.classPackageAsResourcePath(baseClass); - return Files.walk(Paths.get(fullPath)) - .filter(Objects::nonNull) - .filter(Files::isRegularFile) - .filter(path -> { - String fileName = path.getFileName().toString(); - if (fileName == null) { - return false; - } - return fileName.endsWith(".class"); - }) - .map(path -> { + return filterPath(fullPath).map(path -> { String pathString = path.toString(); // 去头去尾 pathString = pathString @@ -59,6 +96,25 @@ public class ScanUtils { }).collect(Collectors.toSet()); } + /** + * 过滤类 + * @param fullPath 类的全路径 + * @return Stream + * @throws IOException IOException + */ + private static Stream filterPath(String fullPath) throws IOException { + return Files.walk(Paths.get(fullPath)) + .filter(Objects::nonNull) + .filter(Files::isRegularFile) + .filter(path -> { + String fileName = path.getFileName().toString(); + if(fileName == null){ + return false; + } + return fileName.endsWith(".class"); + }); + } + /** * 扫描jar包中的类。 -- Gitee From cd035bfc5635029b2afddceb5275d71aaf8998a9 Mon Sep 17 00:00:00 2001 From: StarBlues Date: Wed, 25 Mar 2020 18:07:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=88=B02.2.3(https://gitee.com/starblues/springboot-plugin-fr?= =?UTF-8?q?amework-parent/issues/I15XPK)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/basic-example/basic-example-main/pom.xml | 4 ++-- example/basic-example/basic-example-runner/pom.xml | 2 +- .../plugins/basic-example-plugin1/plugin.properties | 2 +- .../basic-example/plugins/basic-example-plugin1/pom.xml | 4 ++-- .../plugins/basic-example-plugin2/plugin.properties | 2 +- .../basic-example/plugins/basic-example-plugin2/pom.xml | 4 ++-- example/basic-example/plugins/pom.xml | 2 +- example/basic-example/pom.xml | 2 +- .../integration-mybatis/integration-mybatis-main/pom.xml | 8 ++++---- .../integration-mybatis-plugin-parent/pom.xml | 2 +- .../integration-mybatis-runner/pom.xml | 2 +- .../plugins/integration-mybatis-plugin1/plugin.properties | 2 +- .../plugins/integration-mybatis-plugin1/pom.xml | 4 ++-- .../plugins/integration-mybatis-plugin2/plugin.properties | 2 +- .../plugins/integration-mybatis-plugin2/pom.xml | 4 ++-- example/integration-mybatis/pom.xml | 2 +- .../integration-mybatisplus-main/pom.xml | 6 +++--- .../integration-mybatisplus-plugin/plugin.properties | 2 +- .../plugins/integration-mybatisplus-plugin/pom.xml | 2 +- example/integration-mybatisplus/pom.xml | 2 +- example/pom.xml | 2 +- pom.xml | 2 +- springboot-plugin-framework-extension/pom.xml | 2 +- .../springboot-plugin-framework-extension-mybatis/pom.xml | 4 ++-- .../pom.xml | 4 ++-- springboot-plugin-framework/pom.xml | 2 +- .../com/gitee/starblues/extension/AbstractExtension.java | 1 + .../process/post/bean/PluginInvokePostProcessor.java | 1 + .../integration/operator/DefaultPluginOperator.java | 1 + 29 files changed, 41 insertions(+), 38 deletions(-) diff --git a/example/basic-example/basic-example-main/pom.xml b/example/basic-example/basic-example-main/pom.xml index cadafe3..82b23e6 100644 --- a/example/basic-example/basic-example-main/pom.xml +++ b/example/basic-example/basic-example-main/pom.xml @@ -13,14 +13,14 @@ com.gitee.starblues basic-example-main - 2.2.2-RELEASE + 2.2.3-RELEASE jar 2.7.0 2.3.2 1.6 - 2.2.2-RELEASE + 2.2.3-RELEASE diff --git a/example/basic-example/basic-example-runner/pom.xml b/example/basic-example/basic-example-runner/pom.xml index f15d476..2e56acf 100644 --- a/example/basic-example/basic-example-runner/pom.xml +++ b/example/basic-example/basic-example-runner/pom.xml @@ -14,7 +14,7 @@ com.gitee.starblues basic-example-runner - 2.2.2-RELEASE + 2.2.3-RELEASE pom diff --git a/example/basic-example/plugins/basic-example-plugin1/plugin.properties b/example/basic-example/plugins/basic-example-plugin1/plugin.properties index a62fec6..ee94449 100644 --- a/example/basic-example/plugins/basic-example-plugin1/plugin.properties +++ b/example/basic-example/plugins/basic-example-plugin1/plugin.properties @@ -1,4 +1,4 @@ plugin.id=basic-example-plugin1 plugin.class=com.basic.example.plugin1.DefinePlugin -plugin.version=2.2.2-RELEASE +plugin.version=2.2.3-RELEASE plugin.provider=StarBlues \ No newline at end of file diff --git a/example/basic-example/plugins/basic-example-plugin1/pom.xml b/example/basic-example/plugins/basic-example-plugin1/pom.xml index d5024f7..9fe66f3 100644 --- a/example/basic-example/plugins/basic-example-plugin1/pom.xml +++ b/example/basic-example/plugins/basic-example-plugin1/pom.xml @@ -8,12 +8,12 @@ com.gitee.starblues basic-example-plugin-parent - 2.2.2-RELEASE + 2.2.3-RELEASE ../pom.xml basic-example-plugin1 - 2.2.2-RELEASE + 2.2.3-RELEASE jar diff --git a/example/basic-example/plugins/basic-example-plugin2/plugin.properties b/example/basic-example/plugins/basic-example-plugin2/plugin.properties index b1bef3e..00c6e52 100644 --- a/example/basic-example/plugins/basic-example-plugin2/plugin.properties +++ b/example/basic-example/plugins/basic-example-plugin2/plugin.properties @@ -1,4 +1,4 @@ plugin.id=basic-example-plugin2 plugin.class=com.basic.example.plugin2.DefinePlugin -plugin.version=2.2.2-RELEASE +plugin.version=2.2.3-RELEASE plugin.provider=StarBlues \ No newline at end of file diff --git a/example/basic-example/plugins/basic-example-plugin2/pom.xml b/example/basic-example/plugins/basic-example-plugin2/pom.xml index 530c2eb..599b3c7 100644 --- a/example/basic-example/plugins/basic-example-plugin2/pom.xml +++ b/example/basic-example/plugins/basic-example-plugin2/pom.xml @@ -8,12 +8,12 @@ com.gitee.starblues basic-example-plugin-parent - 2.2.2-RELEASE + 2.2.3-RELEASE ../pom.xml basic-example-plugin2 - 2.2.2-RELEASE + 2.2.3-RELEASE jar diff --git a/example/basic-example/plugins/pom.xml b/example/basic-example/plugins/pom.xml index bb9d2b3..533e70f 100644 --- a/example/basic-example/plugins/pom.xml +++ b/example/basic-example/plugins/pom.xml @@ -7,7 +7,7 @@ com.gitee.starblues basic-example-plugin-parent - 2.2.2-RELEASE + 2.2.3-RELEASE pom diff --git a/example/basic-example/pom.xml b/example/basic-example/pom.xml index 39c9400..bc91e56 100644 --- a/example/basic-example/pom.xml +++ b/example/basic-example/pom.xml @@ -6,7 +6,7 @@ com.gitee.starblues basic-example - 2.2.2-RELEASE + 2.2.3-RELEASE pom 基本案例 diff --git a/example/integration-mybatis/integration-mybatis-main/pom.xml b/example/integration-mybatis/integration-mybatis-main/pom.xml index f748874..f601315 100644 --- a/example/integration-mybatis/integration-mybatis-main/pom.xml +++ b/example/integration-mybatis/integration-mybatis-main/pom.xml @@ -14,14 +14,14 @@ com.gitee.starblues integration-mybatis-main - 2.2.2-RELEASE + 2.2.3-RELEASE jar 主程序模块 - 2.2.2-RELEASE - 2.2.2-RELEASE - 2.2.2-RELEASE + 2.2.3-RELEASE + 2.2.3-RELEASE + 2.2.3-RELEASE 2.0.1 2.7.0 1.6 diff --git a/example/integration-mybatis/integration-mybatis-plugin-parent/pom.xml b/example/integration-mybatis/integration-mybatis-plugin-parent/pom.xml index 269bb1f..cbb0865 100644 --- a/example/integration-mybatis/integration-mybatis-plugin-parent/pom.xml +++ b/example/integration-mybatis/integration-mybatis-plugin-parent/pom.xml @@ -7,7 +7,7 @@ com.gitee.starblues integration-mybatis-plugin-parent - 2.2.2-RELEASE + 2.2.3-RELEASE pom diff --git a/example/integration-mybatis/integration-mybatis-runner/pom.xml b/example/integration-mybatis/integration-mybatis-runner/pom.xml index afa68f0..a10c71a 100644 --- a/example/integration-mybatis/integration-mybatis-runner/pom.xml +++ b/example/integration-mybatis/integration-mybatis-runner/pom.xml @@ -14,7 +14,7 @@ com.gitee.starblues integration-mybatis-runner - 2.2.2-RELEASE + 2.2.3-RELEASE jar 启动程序模块。将启动类配置到该模块下 diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin1/plugin.properties b/example/integration-mybatis/plugins/integration-mybatis-plugin1/plugin.properties index 086145a..4ff6f8f 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/plugin.properties +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin1/plugin.properties @@ -1,4 +1,4 @@ plugin.id=integration-mybatis-plugin1 plugin.class=com.mybatis.plugin1.ExamplePlugin1 -plugin.version=2.2.2-RELEASE +plugin.version=2.2.3-RELEASE plugin.provider=StarBlues \ No newline at end of file diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin1/pom.xml b/example/integration-mybatis/plugins/integration-mybatis-plugin1/pom.xml index 51ed59e..d509a5c 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/pom.xml +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin1/pom.xml @@ -8,12 +8,12 @@ com.gitee.starblues integration-mybatis-plugin-parent - 2.2.2-RELEASE + 2.2.3-RELEASE ../../integration-mybatis-plugin-parent/pom.xml integration-mybatis-plugin1 - 2.2.2-RELEASE + 2.2.3-RELEASE jar diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin2/plugin.properties b/example/integration-mybatis/plugins/integration-mybatis-plugin2/plugin.properties index ae4c430..9fc286a 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin2/plugin.properties +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin2/plugin.properties @@ -1,4 +1,4 @@ plugin.id=integration-mybatis-plugin2 plugin.class=com.mybatis.plugin2.ExamplePlugin2 -plugin.version=2.2.2-RELEASE +plugin.version=2.2.3-RELEASE plugin.provider=StarBlues \ No newline at end of file diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin2/pom.xml b/example/integration-mybatis/plugins/integration-mybatis-plugin2/pom.xml index d4580c8..7fa6328 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin2/pom.xml +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin2/pom.xml @@ -8,12 +8,12 @@ com.gitee.starblues integration-mybatis-plugin-parent - 2.2.2-RELEASE + 2.2.3-RELEASE ../../integration-mybatis-plugin-parent/pom.xml integration-mybatis-plugin2 - 2.2.2-RELEASE + 2.2.3-RELEASE jar diff --git a/example/integration-mybatis/pom.xml b/example/integration-mybatis/pom.xml index 4f25fa2..3faec6d 100644 --- a/example/integration-mybatis/pom.xml +++ b/example/integration-mybatis/pom.xml @@ -7,7 +7,7 @@ com.gitee.starblues integration-mybatis - 2.2.2-RELEASE + 2.2.3-RELEASE pom 集成mybatis案例 diff --git a/example/integration-mybatisplus/integration-mybatisplus-main/pom.xml b/example/integration-mybatisplus/integration-mybatisplus-main/pom.xml index 5868bc6..b618462 100644 --- a/example/integration-mybatisplus/integration-mybatisplus-main/pom.xml +++ b/example/integration-mybatisplus/integration-mybatisplus-main/pom.xml @@ -13,7 +13,7 @@ com.gitee.starblues - 2.2.2-RELEASE + 2.2.3-RELEASE integration-mybatisplus-main jar 集成mybatis-plus 案例--主程序 @@ -27,8 +27,8 @@ 2.0.1 3.2.0 - 2.2.2-RELEASE - 2.2.2-RELEASE + 2.2.3-RELEASE + 2.2.3-RELEASE 2.7.0 1.6 diff --git a/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/plugin.properties b/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/plugin.properties index 88aa9fe..6bff82a 100644 --- a/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/plugin.properties +++ b/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/plugin.properties @@ -1,4 +1,4 @@ plugin.id=integration-mybatisplus-plugin plugin.class=com.mybatisplus.plugin.MybatisPlusPlugin -plugin.version=2.2.2-RELEASE +plugin.version=2.2.3-RELEASE plugin.provider=StarBlues \ No newline at end of file diff --git a/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/pom.xml b/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/pom.xml index b8cce26..76505b0 100644 --- a/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/pom.xml +++ b/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/pom.xml @@ -6,7 +6,7 @@ com.gitee.starblues integration-mybatisplus-plugin - 2.2.2-RELEASE + 2.2.3-RELEASE jar diff --git a/example/integration-mybatisplus/pom.xml b/example/integration-mybatisplus/pom.xml index 71cdb24..75ce917 100644 --- a/example/integration-mybatisplus/pom.xml +++ b/example/integration-mybatisplus/pom.xml @@ -6,7 +6,7 @@ com.gitee.starblues integration-mybatisplus - 2.2.2-RELEASE + 2.2.3-RELEASE pom 集成mybatis-plus案例 diff --git a/example/pom.xml b/example/pom.xml index 1cac07c..4df045d 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -6,7 +6,7 @@ com.gitee.starblues springboot-plugin-framework-example - 2.2.2-RELEASE + 2.2.3-RELEASE pom diff --git a/pom.xml b/pom.xml index a03328d..44a212a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.gitee.starblues springboot-plugin-framework-parent pom - 2.2.2-RELEASE + 2.2.3-RELEASE spring boot 插件开发集成包 diff --git a/springboot-plugin-framework-extension/pom.xml b/springboot-plugin-framework-extension/pom.xml index c05a6f6..f418c24 100644 --- a/springboot-plugin-framework-extension/pom.xml +++ b/springboot-plugin-framework-extension/pom.xml @@ -9,7 +9,7 @@ com.gitee.starblues springboot-plugin-framework-extension pom - 2.2.2-RELEASE + 2.2.3-RELEASE spring boot 插件式开发集成包--扩展模块 diff --git a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/pom.xml b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/pom.xml index 49b92e1..205f27b 100644 --- a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/pom.xml +++ b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/pom.xml @@ -13,7 +13,7 @@ com.gitee.starblues springboot-plugin-framework-extension-mybatis - 2.2.2-RELEASE + 2.2.3-RELEASE jar 插件扩展-spring boot mybatis 集成扩展 @@ -64,7 +64,7 @@ 3.1.0 1.6 - 2.2.2-RELEASE + 2.2.3-RELEASE 2.0.1 3.2.0 diff --git a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/pom.xml b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/pom.xml index b2c77d0..ed9286d 100644 --- a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/pom.xml +++ b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-resources/pom.xml @@ -13,7 +13,7 @@ com.gitee.starblues springboot-plugin-framework-extension-resources - 2.2.2-RELEASE + 2.2.3-RELEASE jar 插件扩展-通过url读取插件中的静态资源 @@ -69,7 +69,7 @@ 5.0.7.RELEASE 4.0.1 - 2.2.2-RELEASE + 2.2.3-RELEASE 2.1.1.RELEASE diff --git a/springboot-plugin-framework/pom.xml b/springboot-plugin-framework/pom.xml index 4d2d893..6269ed4 100644 --- a/springboot-plugin-framework/pom.xml +++ b/springboot-plugin-framework/pom.xml @@ -13,7 +13,7 @@ com.gitee.starblues springboot-plugin-framework jar - 2.2.2-RELEASE + 2.2.3-RELEASE spring boot 插件式开发集成包 diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java index 9d24c16..7307095 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/extension/AbstractExtension.java @@ -33,6 +33,7 @@ public abstract class AbstractExtension { /** * 该扩展初始化的操作 * 主要是在插件初始化阶段被调用 + * @param applicationContext applicationContext * @throws Exception 初始化异常 */ public void initialize(ApplicationContext applicationContext) throws Exception{ diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java index 9a11caa..d97746b 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/process/post/bean/PluginInvokePostProcessor.java @@ -16,6 +16,7 @@ import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.context.ApplicationContext; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.util.ClassUtils; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java index 449f229..542cdbb 100644 --- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java +++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/operator/DefaultPluginOperator.java @@ -486,6 +486,7 @@ public class DefaultPluginOperator implements PluginOperator { /** * 得到插件包装类 * @param pluginId 插件id + * @param errorMsg 错误信息 * @return PluginWrapper * @throws Exception 插件装配异常 */ -- Gitee