diff --git a/README.md b/README.md index 5005ba4814e7766e74b571499be7c0055e0b68a1..153f3b2f94e5c8a6e511ea1a03c489ab248cac5e 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Maven目录结构下所示 1. pom.xml 代表maven的pom.xml 2. plugin.properties 为开发环境下, 插件的元信息配置文件, 配置内容详见下文。 3. example 为项目的总Maven目录。 -4. example-runner 在运行环境下启动的模块。主要依赖example-main模块和插件中使用到的依赖包。 +4. example-runner 在运行环境下启动的模块。主要依赖example-main模块和插件中使用到的依赖包, 并且解决开发环境下无法找到插件依赖包的问题。 5. example-main 该模块为项目的主程序模块。 6. example-plugin-parent 该模块为插件的父级maven pom 模块, 主要定义插件中公共用到的依赖, 以及插件的打包配置。 7. plugins 该文件夹下主要存储插件模块。上述模块中主要包括example-plugin1、example-plugin2 两个插件。 @@ -296,7 +296,7 @@ public class PluginBeanConfig { 定义打包配置.主要用途是将 `Plugin-Id、Plugin-Version、Plugin-Provider、Plugin-Class、Plugin-Dependencies`的配置值定义到`META-INF\MANIFEST.MF`文件中 ```xml - springboot-plugin-example-plugin1 + example-plugin1 com.plugin.example.plugin1.DefinePlugin ${project.version} StarBlues @@ -361,7 +361,7 @@ public class PluginBeanConfig { 2. 在插件包的一级目录下新建plugin.properties文件(用于开发环境) 新增如下内容(属性值同步骤1中pom.xml定义的`manifestEntries`属性一致): ``` -plugin.id=springboot-plugin-example-plugin1 +plugin.id=example-plugin1 plugin.class=com.plugin.example.plugin1.DefinePlugin plugin.version=2.0-SNAPSHOT plugin.provider=StarBlues @@ -464,13 +464,15 @@ public class HelloPlugin1 { + + @@ -478,7 +480,7 @@ public class HelloPlugin1 { 2. 设置idea的启动 -Working directory : D:\xx\xx\springboot-plugin-framework-parent\plugin-example +Working directory : D:\xx\xx\plugin-example Use classpath of module: plugin-exampe-runner @@ -489,14 +491,14 @@ Use classpath of module: plugin-exampe-runner 观察日志出现如下说明加载插件成功。 ``` java - Plugin 'springboot-plugin-example-plugin1@2.0-RELEASE' resolved - Start plugin 'springboot-plugin-example-plugin1@2.0-RELEASE' - Init Plugins Success + Plugin 'example-plugin1@2.0-RELEASE' resolved + Start plugin 'example-plugin1@2.0-RELEASE' + Init Plugins Success ``` 4. 访问插件中的Controller 验证。 -浏览器输入:http://ip:port/api/plugins/basic-example-plugin1/plugin1/plugin1 +浏览器输入:http://ip:port/api/plugins/example-plugin1/plugin1 响应并显示: hello plugin1 example @@ -589,7 +591,7 @@ public class HelloService { *在开发环境:配置文件必须放在resources目录下。并且@ConfigDefinition("plugin1.yml")中定义的文件名和resources下配置的文件名一致。* -*在生产环境: 该文件存放在`pluginConfigFilePath`配置的目录下。* +*在生产环境: 该文件存放在`pluginConfigFilePath`配置的目录下。生产环境下插件的配置文件必须外置, 不能使用jar包里面的配置文件 * #### 插件之间数据交互功能 @@ -770,9 +772,9 @@ example-plugin1 2. 如果启动时插件没有加载。请检查配置文件中的 pluginPath ```text -如果pluginPath 配置为相当路径,请检查是否是相对于当前工作环境的目录。 +如果 pluginPath 配置为相当路径,请检查是否是相对于当前工作环境的目录。 -如果pluginPath配置为绝对路径,请检查路径是否正确。 +如果 pluginPath 配置为绝对路径,请检查路径是否正确。 ``` 3. 如果出现Spring包冲突。可以排除Spring包。 diff --git a/example/basic-example/basic-example-main/src/main/resources/application-dev.yml b/example/basic-example/basic-example-main/src/main/resources/application-dev.yml index 7303ec40b44cd9ef61b82fb5f213bffca7461eaf..5586028e3e7314585a6024f24bc8a16390b9dcaa 100644 --- a/example/basic-example/basic-example-main/src/main/resources/application-dev.yml +++ b/example/basic-example/basic-example-main/src/main/resources/application-dev.yml @@ -3,5 +3,5 @@ server: plugin: runMode: dev - pluginPath: plugins + pluginPath: ./example/basic-example/plugins pluginConfigFilePath: \ No newline at end of file diff --git a/example/basic-example/basic-example-runner/pom.xml b/example/basic-example/basic-example-runner/pom.xml index f00d93947f35a480b7f0cbd03f6eb4f6440cb7a1..d0866dc44ed16eab0e21f5a50ab93bdf5b037880 100644 --- a/example/basic-example/basic-example-runner/pom.xml +++ b/example/basic-example/basic-example-runner/pom.xml @@ -27,15 +27,6 @@ basic-example-main ${project.version} - - - - com.google.code.gson - gson - ${gson.version} - provided - - \ 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 4405990caf6fb3b26c7d5d6d92384cabd932e7c2..e31deecf93794feb9bb0b53dd38416cd376051b4 100644 --- a/example/basic-example/plugins/basic-example-plugin1/pom.xml +++ b/example/basic-example/plugins/basic-example-plugin1/pom.xml @@ -25,15 +25,5 @@ 2.8.2 - - - - com.google.code.gson - gson - ${gson.version} - - - - \ No newline at end of file diff --git a/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/rest/HelloPlugin1.java b/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/rest/HelloPlugin1.java index 253db81092c8016db36f734ed6af744bf7c1998b..269519d128857867d5b0ae320e2a0e375473d448 100644 --- a/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/rest/HelloPlugin1.java +++ b/example/basic-example/plugins/basic-example-plugin1/src/main/java/com/basic/example/plugin1/rest/HelloPlugin1.java @@ -2,7 +2,6 @@ package com.basic.example.plugin1.rest; import com.basic.example.plugin1.config.PluginConfig1; import com.basic.example.plugin1.service.HelloService; -import com.google.gson.Gson; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -27,8 +26,6 @@ public class HelloPlugin1 { @Autowired private PluginConfig1 pluginConfig1; - private Gson gson = new Gson(); - @GetMapping("plugin1") @ApiOperation(value = "hello", notes = "hello") @@ -54,13 +51,5 @@ public class HelloPlugin1 { } - /** - * 依赖测试 - * @return - */ - @GetMapping("dependency") - public String gson(){ - return gson.toJson(pluginConfig1); - } } 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 212fa74962fc61391551c48770a1253b23cca97f..bba9873f1e3607672edcbbcb626de379baf59c57 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 @@ -16,5 +16,5 @@ mybatis-plus: plugin: runMode: dev - pluginPath: plugins + pluginPath: ./example/integration-mybatis/plugins pluginConfigFilePath: \ No newline at end of file diff --git a/example/integration-mybatis/integration-mybatis-runner/pom.xml b/example/integration-mybatis/integration-mybatis-runner/pom.xml index 5ae0f1a1f95fbc93e657d2a95b78f24c7d0e63d9..46b7ae184e19389e93c197ef15b5b16d43dd76a9 100644 --- a/example/integration-mybatis/integration-mybatis-runner/pom.xml +++ b/example/integration-mybatis/integration-mybatis-runner/pom.xml @@ -29,14 +29,6 @@ ${project.version} - - - com.google.code.gson - gson - ${gson.version} - provided - - \ 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 c9c89b0691e40518509886e4d7f05e739ad02e15..4b0281cc3027b7359720f84baf79874e4bec4943 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/pom.xml +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin1/pom.xml @@ -27,15 +27,6 @@ 2.1.2-RELEASE - - - - com.google.code.gson - gson - ${gson.version} - - - \ No newline at end of file diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/config/PluginBeanConfiguration.java b/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/config/PluginBeanConfiguration.java deleted file mode 100644 index a40fcbf76130057aaa522220e4e31191c71d7d25..0000000000000000000000000000000000000000 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/config/PluginBeanConfiguration.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mybatis.plugin1.config; - -import com.google.gson.Gson; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * description - * - * @author zhangzhuo - * @version 1.0 - */ -@Configuration -public class PluginBeanConfiguration { - - @Bean("dewd") - public Gson gson(){ - return new Gson(); - } - - -} diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/Plugin1Controller.java b/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/Plugin1Controller.java index 6895ae5c34e66a203d7bc28979ac97fb4b4fcfcc..45bb343bbbf1872cdf79652f8165f1f04265118e 100644 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/Plugin1Controller.java +++ b/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/rest/Plugin1Controller.java @@ -1,9 +1,7 @@ package com.mybatis.plugin1.rest; -import com.google.gson.Gson; import com.mybatis.plugin1.entity.Plugin1; import com.mybatis.plugin1.mapper.Plugin1Mapper; -import com.mybatis.plugin1.service.TestService; import com.mybatis.plugin1.service.TranServiec; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -27,19 +25,12 @@ public class Plugin1Controller { @Autowired private Plugin1Mapper pluginMapperl; - @Autowired - private Gson gson; - - @Autowired - private TestService testService; - @Autowired private TranServiec testTransactional; @GetMapping public String hello(){ - testService.gson(); - return gson.toJson(pluginMapperl.getList()); + return "hello, 这是集成mybatis 插件1"; } @GetMapping("/list") diff --git a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/service/TestService.java b/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/service/TestService.java deleted file mode 100644 index fd87ebf0c19a2dc66a0281951bd86885ba06a238..0000000000000000000000000000000000000000 --- a/example/integration-mybatis/plugins/integration-mybatis-plugin1/src/main/java/com/mybatis/plugin1/service/TestService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.mybatis.plugin1.service; - -import com.google.gson.Gson; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * service 测试 - * - * @author zhangzhuo - * @version 1.0 - */ -@Service -public class TestService { - - @Autowired - private Gson gson; - - - public void gson(){ - System.out.println(gson.toJson("123")); - } - - - -} diff --git a/example/integration-mybatisplus/integration-mybatisplus-main/src/main/resources/application-dev.yml b/example/integration-mybatisplus/integration-mybatisplus-main/src/main/resources/application-dev.yml index ec26bb2d790e222eb5f0ee79ac37bdce8fa649ef..fb86076c138bf8da94ea42cdba02fe67f89a054e 100644 --- a/example/integration-mybatisplus/integration-mybatisplus-main/src/main/resources/application-dev.yml +++ b/example/integration-mybatisplus/integration-mybatisplus-main/src/main/resources/application-dev.yml @@ -17,5 +17,5 @@ mybatis-plus: plugin: runMode: dev - pluginPath: plugins + pluginPath: ./example/integration-mybatisplus/plugins pluginConfigFilePath: \ No newline at end of file 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 ce27fd38e0c9ca364fb1df4e6be553dd260e216b..3f1422b786c9113b35c29d54be5a61bf1cce57be 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 @@ -179,7 +179,7 @@ public class PluginDataServiceImpl extends ServiceImplWrapper