diff --git a/README.md b/README.md
index e62f5a2d9704ef18b2c015027e7e17412312d8a7..7c01cb34c67448aace978a6e6ea9d98655efa186 100644
--- a/README.md
+++ b/README.md
@@ -80,7 +80,7 @@ Maven目录结构下所示
com.gitee.starblues
springboot-plugin-framework
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
```
@@ -825,6 +825,9 @@ File->Project Structure->Project Settings->Artifacts->点击+号->JAR->From modu
### 版本更新
+#### 2.1.3 版本
+在PluginUser接口新增getMainBeans方法, 用于获取Spring管理的主程序接口的实现类。
+
#### 2.1.2 版本
1. 修复使用多AOP情况, 无法加载插件类(被AOP代理的类)的bug。
2. 新增可以通过插件id获取插件中的bean的实现。详见:PluginUser->getPluginBeans(String pluginId, Class aClass)
diff --git a/example/basic-example/basic-example-main/pom.xml b/example/basic-example/basic-example-main/pom.xml
index bbb7639823760cdc8fd507fff3a31d0ca1c44fc2..0d15f5c30157cbcdbe593e7a8f4a0d4fb999a7b8 100644
--- a/example/basic-example/basic-example-main/pom.xml
+++ b/example/basic-example/basic-example-main/pom.xml
@@ -13,7 +13,7 @@
com.gitee.starblues
basic-example-main
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
jar
diff --git a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/rest/HelloResource.java b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/rest/HelloResource.java
index f132b237379bde785ea32ff3aecb5008e7064839..2e28b81e127ef9f67b40acb9f922eb470548d994 100644
--- a/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/rest/HelloResource.java
+++ b/example/basic-example/basic-example-main/src/main/java/com/basic/example/main/rest/HelloResource.java
@@ -35,8 +35,23 @@ public class HelloResource {
return "hello spring boot plugin example";
}
+
+ /**
+ * 通过 PluginUser 获取到主程序的实现类
+ * 打印实现接口 com.basic.demo.main.main.plugin.ConsoleName 的实现类
+ * @return 返回所有实现 com.basic.demo.main.main.plugin.ConsoleName 接口的实现类的 name() 方法的输出
+ */
+ @GetMapping("/mainConsoleName")
+ public String mainConsoleName(){
+ StringBuffer stringBuffer = new StringBuffer();
+ // 获取到实现该接口的实现类
+ List consoleNames = pluginUser.getMainBeans(ConsoleName.class);
+ return getConsoleNames(stringBuffer, consoleNames);
+ }
+
+
/**
- * 通过 PluginUser 获取实现类
+ * 通过 PluginUser 获取到主程序和插件中所有的实现类
* 打印实现接口 com.basic.demo.main.main.plugin.ConsoleName 的实现类
* @return 返回所有实现 com.basic.demo.main.main.plugin.ConsoleName 接口的实现类的 name() 方法的输出
*/
@@ -49,7 +64,7 @@ public class HelloResource {
}
/**
- * 通过 PluginUser 获取实现类
+ * 通过 PluginUser 获取插件中的实现类
* 打印实现接口 com.basic.demo.main.main.plugin.ConsoleName 接口的插件中的实现类
* @return 返回所有实现 com.basic.demo.main.main.plugin.ConsoleName 接口的插件中实现类的 name() 方法的输出
*/
@@ -75,7 +90,7 @@ public class HelloResource {
/**
- * 通过 AbstractPluginSpringBeanRefresh 工厂获取实现类
+ * 通过 插件id 获取指定的插件中的实现类
* 打印实现接口 com.basic.demo.main.main.plugin.ConsoleName 的实现类
* @return 返回所有实现 com.basic.demo.main.main.plugin.ConsoleName 接口的实现类的 name() 方法的输出
*/
diff --git a/example/basic-example/basic-example-runner/pom.xml b/example/basic-example/basic-example-runner/pom.xml
index d0866dc44ed16eab0e21f5a50ab93bdf5b037880..334b1e71f2cae83cf0caf45864b2c7890c5c79ef 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.1.2-RELEASE
+ 2.1.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 c6e214cc2a5db40ac6f77a6adf2bb9ead6577a0a..d88dc4c8909a5aa090f80222cd64c5215fc03e64 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.1.2-RELEASE
+plugin.version=2.1.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 e31deecf93794feb9bb0b53dd38416cd376051b4..69428eb293a9ce63bcc4dbee376d3e6454990dc3 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.1.2-RELEASE
+ 2.1.3-RELEASE
../pom.xml
basic-example-plugin1
- 2.1.2-RELEASE
+ 2.1.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 c427e920652d0cc692ad4517140ed5f7e3f58ff5..66410a19c9ec9f37a00b146a763892eba4ecf5b8 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.1.2-RELEASE
+plugin.version=2.1.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 01a40c3b8f3d0288cbb96cde1dcd18f37667a049..83d634965ce8a4bde2da0063320db7cd22f15dac 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.1.2-RELEASE
+ 2.1.3-RELEASE
../pom.xml
basic-example-plugin2
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
jar
diff --git a/example/basic-example/plugins/pom.xml b/example/basic-example/plugins/pom.xml
index de6db8d8c4fc0047918ce3269ef5ff936fe54ff9..aaf8c435f4b8b089cbdaf7511b444cc3c87d547a 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.1.2-RELEASE
+ 2.1.3-RELEASE
pom
diff --git a/example/basic-example/pom.xml b/example/basic-example/pom.xml
index 03da47f3b788362361499afe0de28cef12c0c337..4aa3fd5693a81b20bc2a6030ef523970ebb059e8 100644
--- a/example/basic-example/pom.xml
+++ b/example/basic-example/pom.xml
@@ -6,7 +6,7 @@
com.gitee.starblues
basic-example
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
pom
基本案例
diff --git a/example/integration-mybatis/integration-mybatis-main/pom.xml b/example/integration-mybatis/integration-mybatis-main/pom.xml
index 0fda6581ff96259d6fb53c93651f38e1635c52c5..901a70423c2da0acdc692b6fed76e40db7398e4e 100644
--- a/example/integration-mybatis/integration-mybatis-main/pom.xml
+++ b/example/integration-mybatis/integration-mybatis-main/pom.xml
@@ -14,13 +14,13 @@
com.gitee.starblues
integration-mybatis-main
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
jar
主程序模块
2.0.1
- 2.1.1-RELEASE
+ 2.1.3-RELEASE
2.7.0
1.6
diff --git a/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-dev.yml b/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-dev.yml
index bba9873f1e3607672edcbbcb626de379baf59c57..c4d75050be2ce6caeafa72ef920a7eee70d1a2ab 100644
--- a/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-dev.yml
+++ b/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-dev.yml
@@ -8,11 +8,10 @@ spring:
password: 123456
driver-class-name: com.mysql.jdbc.Driver
-mybatis-plus:
- typeAliasesPackage: com.persistence.example.entity
- mapperLocations: classpath*:mapper/*.xml
- configuration:
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis:
+ typeAliasesPackage: com.mybatis.main.entity
+ mapperLocations: classpath:mapper/*.xml
+
plugin:
runMode: dev
diff --git a/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-prod.yml b/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-prod.yml
index b11911cb4c8dedcddda0edee57e77daddba97dd8..eafc8bb1b2477fd4f00f55d640b1b1974f30f234 100644
--- a/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-prod.yml
+++ b/example/integration-mybatis/integration-mybatis-main/src/main/resources/application-prod.yml
@@ -9,8 +9,8 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
mybatis:
- typeAliasesPackage: com.persistence.example.entity
- mapper-locations: classpath*:mapper/*.xml
+ typeAliasesPackage: com.mybatis.main.entity
+ mapperLocations: classpath:mapper/*.xml
plugin:
runMode: prod
diff --git a/example/integration-mybatis/integration-mybatis-plugin-parent/pom.xml b/example/integration-mybatis/integration-mybatis-plugin-parent/pom.xml
index 5e6205169e3bba1073f99f9ecb5ad88cc310e7a7..c0c4addc9275b4f3909e7ca8a9dc50fb63904e1d 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.1.2-RELEASE
+ 2.1.3-RELEASE
pom
diff --git a/example/integration-mybatis/integration-mybatis-runner/pom.xml b/example/integration-mybatis/integration-mybatis-runner/pom.xml
index 46b7ae184e19389e93c197ef15b5b16d43dd76a9..6fb9f0ce10b1be901b258d16ce0eba008059e712 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.1.2-RELEASE
+ 2.1.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 6962b0a4b920555b0ab4e3bc13eab20f11e75d8a..5c4ed48bd6893d7c1d3cab6fe46c2b9d950c7005 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.1.2-RELEASE
+plugin.version=2.1.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 4b0281cc3027b7359720f84baf79874e4bec4943..d98b889e68f9d40d07fe6381b2e262a9bc820d60 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.1.2-RELEASE
+ 2.1.3-RELEASE
../../integration-mybatis-plugin-parent
integration-mybatis-plugin1
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
jar
@@ -24,7 +24,7 @@
2.8.2
2.0.1
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin2/plugin.properties b/example/integration-mybatis/plugins/integration-mybatis-plugin2/plugin.properties
index 94fa87aa40a184f6b00a469f05ed3881e3466e9b..edb904a959890a47155953afcecfd6a66fc9bef4 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.1.2-RELEASE
+plugin.version=2.1.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 a7e58b3bfa1a3a1b1ef1bf7e4914b4855f89ab30..f3f645b39fdf6dd2a6e819c673d5ce1efda302c0 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.1.2-RELEASE
+ 2.1.3-RELEASE
../../integration-mybatis-plugin-parent
integration-mybatis-plugin2
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
jar
@@ -24,7 +24,7 @@
2.8.2
2.0.1
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
diff --git a/example/integration-mybatis/pom.xml b/example/integration-mybatis/pom.xml
index 2cfcf96f56aac9878c990b36a2c5b90ae2252257..58ef949440a16cae79387d65c8e7ae68d4b49db4 100644
--- a/example/integration-mybatis/pom.xml
+++ b/example/integration-mybatis/pom.xml
@@ -7,7 +7,7 @@
com.gitee.starblues
integration-mybatis
- 2.1.2-RELEASE
+ 2.1.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 f6bfb6cf9f1dacdfbd4d0a190f591b7792a4bd04..a9059791cb9b3286907a188527e1acdff10328da 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.1.2-RELEASE
+ 2.1.3-RELEASE
integration-mybatisplus-main
jar
集成mybatis-plus 案例--主程序
@@ -26,7 +26,7 @@
2.0.1
3.2.0
- 2.1.1-RELEASE
+ 2.1.3-RELEASE
2.7.0
1.6
diff --git a/example/integration-mybatisplus/integration-mybatisplus-main/src/main/java/com/mybatisplus/main/rest/UserController.java b/example/integration-mybatisplus/integration-mybatisplus-main/src/main/java/com/mybatisplus/main/rest/UserController.java
index 6ba460122b36554387f001e91255ceff37248d75..c11b6e410e0b47135919414051c3929b011092dc 100644
--- a/example/integration-mybatisplus/integration-mybatisplus-main/src/main/java/com/mybatisplus/main/rest/UserController.java
+++ b/example/integration-mybatisplus/integration-mybatisplus-main/src/main/java/com/mybatisplus/main/rest/UserController.java
@@ -29,13 +29,13 @@ public class UserController {
user.setName("test");
user.setPassword("123");
user.setUsername("user");
- //userService.save(user);
+ userService.save(user);
return user;
}
@GetMapping
public List getAll(){
- return null;
+ return userService.list();
}
}
diff --git a/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/plugin.properties b/example/integration-mybatisplus/plugins/integration-mybatisplus-plugin/plugin.properties
index ff568ab7042c17b199fb11002cba3c5b25ada121..e4ccdd01f332cc18e215de8de6c0d2e7df14e5da 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.1.2-RELEASE
+plugin.version=2.1.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 66b65993b6374ef05609fd96962aa1c0023a797b..a8ec8a6284f69caebf8707e78054062098536dd4 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.1.2-RELEASE
+ 2.1.3-RELEASE
jar
diff --git a/example/integration-mybatisplus/pom.xml b/example/integration-mybatisplus/pom.xml
index 6afcf998319f4f076df50be33859a2145d586234..f89d04bd654d883371cc3cd3cc736e21ae1c2298 100644
--- a/example/integration-mybatisplus/pom.xml
+++ b/example/integration-mybatisplus/pom.xml
@@ -6,7 +6,7 @@
com.gitee.starblues
integration-mybatisplus
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
pom
集成mybatis-plus案例
diff --git a/example/pom.xml b/example/pom.xml
index 6d436720772c69d386c0c66dfead651ef02cdb65..ca8e07e261fc19ff5b489405b52d50c4d699e2d8 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -6,7 +6,7 @@
com.gitee.starblues
springboot-plugin-framework-example
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
pom
diff --git a/pom.xml b/pom.xml
index 2019325ca3c3d7ce2fede874ac55d99f385f9cbe..c8bfe7050b583c6dc4fdc5501cfc11df146be23c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
com.gitee.starblues
springboot-plugin-framework-parent
pom
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
spring boot 插件开发集成包
diff --git a/springboot-plugin-framework-extension/pom.xml b/springboot-plugin-framework-extension/pom.xml
index 6d705435662e458a893eeb18b39f92e6c7f63180..8b8aaea4b70d287c7e0786c742e9cb524183f523 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.1.1-RELEASE
+ 2.1.3-RELEASE
spring boot 插件式开发集成包--扩展模块
diff --git a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/README.md b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/README.md
index 3f1422b786c9113b35c29d54be5a61bf1cce57be..4f4861be591f939a7c14e7dcbbc0079f2b726c07 100644
--- a/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/README.md
+++ b/springboot-plugin-framework-extension/springboot-plugin-framework-extension-mybatis/README.md
@@ -176,6 +176,9 @@ public class PluginDataServiceImpl extends ServiceImplWrappercom.gitee.starblues
springboot-plugin-framework-extension-mybatis
- 2.1.1-RELEASE
+ 2.1.3-RELEASE
jar
插件扩展-spring boot mybatis 集成扩展
@@ -64,7 +64,7 @@
3.1.0
1.6
- 2.1.2-RELEASE
+ 2.1.3-RELEASE
2.0.1
3.2.0
diff --git a/springboot-plugin-framework/pom.xml b/springboot-plugin-framework/pom.xml
index 66a9b8a976fdd4fdc6cb37b9eff8994590b72698..55f83872dd50e13ee33decf2e9528de81c607cf4 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.1.2-RELEASE
+ 2.1.3-RELEASE
spring boot 插件式开发集成包
diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/DefaultPluginFactory.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/DefaultPluginFactory.java
index 9bb39e1b37453f01a192e857b67a902e0d96fe12..4e8c24c9a9b638b8f2a3c788c942dd392a130524 100644
--- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/DefaultPluginFactory.java
+++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/factory/DefaultPluginFactory.java
@@ -1,20 +1,17 @@
package com.gitee.starblues.factory;
-import com.gitee.starblues.integration.listener.PluginListener;
-import com.gitee.starblues.integration.listener.PluginListenerFactory;
import com.gitee.starblues.factory.process.pipe.PluginPipeProcessor;
import com.gitee.starblues.factory.process.pipe.PluginPipeProcessorFactory;
import com.gitee.starblues.factory.process.post.PluginPostProcessor;
import com.gitee.starblues.factory.process.post.PluginPostProcessorFactory;
+import com.gitee.starblues.integration.listener.PluginListener;
+import com.gitee.starblues.integration.listener.PluginListenerFactory;
import com.gitee.starblues.utils.AopUtils;
-import com.sun.webkit.plugin.PluginManager;
import org.pf4j.PluginWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.util.ClassUtils;
import java.util.ArrayList;
import java.util.HashMap;
@@ -45,7 +42,6 @@ public class DefaultPluginFactory implements PluginFactory {
*/
private Integer buildType = 0;
private final List buildContainer = new ArrayList<>();
- private final List listenerClasses = new ArrayList<>();
public DefaultPluginFactory(ApplicationContext applicationContext) {
this(applicationContext, null);
@@ -123,7 +119,7 @@ public class DefaultPluginFactory implements PluginFactory {
throw new IllegalAccessException("No Found registered or unRegistry plugin. Unable to build");
}
// 构建注册的Class插件监听者
- pluginListenerFactory.buildListenerClass((GenericApplicationContext) applicationContext);
+ pluginListenerFactory.buildListenerClass(applicationContext);
try {
if(buildType == 1){
registryBuild();
diff --git a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/DefaultPluginUser.java b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/DefaultPluginUser.java
index b76d189187523ee1b91200dba89eaf723aa7d6f7..750bf77c1027db924cd748cf05e959461a240cc8 100644
--- a/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/DefaultPluginUser.java
+++ b/springboot-plugin-framework/src/main/java/com/gitee/starblues/integration/user/DefaultPluginUser.java
@@ -71,6 +71,21 @@ public class DefaultPluginUser implements PluginUser{
.collect(Collectors.toList());
}
+ @Override
+ public List getMainBeans(Class aClass) {
+ Map beansOfTypeMap = applicationContext.getBeansOfType(aClass);
+ if(beansOfTypeMap == null){
+ return Collections.emptyList();
+ }
+ List beans = new ArrayList<>();
+ beansOfTypeMap.forEach((beanName, bean)->{
+ if(!isPluginBean(beanName)){
+ beans.add(bean);
+ }
+ });
+ return beans;
+ }
+
/**
* 在主程序中定义的接口。获取插件中实现该接口的实现类。(Spring管理的bean)
* @param aClass 接口的类
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 05b524f8bea00fab25f814118873248a9ee24918..37d25f8f0d639786a719bdd06f4e4c165c3c4b7b 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
@@ -34,13 +34,23 @@ public interface PluginUser {
T getPluginBean(String name);
/**
- * 在主程序中定义的接口。插件或者主程序实现该接口。可以该方法获取到实现该接口的所有实现类。(Spring管理的bean)
+ * 在主程序中定义的接口。
+ * 插件或者主程序实现该接口。可以该方法获取到实现该接口的所有实现类。(Spring管理的bean)
* @param aClass 接口的类
* @param bean的类型
* @return List
*/
List getBeans(Class aClass);
+ /**
+ * 得到主函数中定义的类。
+ * 主程序实现该接口。可以该方法获取到实现该接口的所有实现类。(Spring管理的bean)
+ * @param aClass 类/接口的类
+ * @param bean 的类型
+ * @return List
+ */
+ List getMainBeans(Class aClass);
+
/**
* 在主程序中定义的接口。获取插件中实现该接口的实现类。(Spring管理的bean)