From 4703e1fc0f0e11f13423182cb644c634398de15d Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Tue, 3 May 2022 13:07:31 +0800 Subject: [PATCH 1/5] update to 3.0.2 --- example-main/pom.xml | 5 ++++- example-plugins-basic/example-basic-1/pom.xml | 3 ++- example-plugins-basic/example-basic-2/pom.xml | 1 + example-plugins-basic/pom.xml | 2 +- example-plugins-cloud/pom.xml | 2 +- example-plugins-db/pom.xml | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/example-main/pom.xml b/example-main/pom.xml index ed883cc..aff13dc 100644 --- a/example-main/pom.xml +++ b/example-main/pom.xml @@ -16,7 +16,7 @@ 1.8 - 3.0.1 + 3.0.2 2.5.6 @@ -98,6 +98,7 @@ spring-boot-starter-aop + org.springframework.boot spring-boot-starter-test @@ -115,6 +116,8 @@ main com.gitee.starblues.example.Application + jar + D:\etc\test-jar\lib diff --git a/example-plugins-basic/example-basic-1/pom.xml b/example-plugins-basic/example-basic-1/pom.xml index 8d971c6..6b46bd0 100644 --- a/example-plugins-basic/example-basic-1/pom.xml +++ b/example-plugins-basic/example-basic-1/pom.xml @@ -30,7 +30,8 @@ basic1-config.yaml - jar + jar-outer + ~\basic1-lib diff --git a/example-plugins-basic/example-basic-2/pom.xml b/example-plugins-basic/example-basic-2/pom.xml index 5536f26..6d6cdc0 100644 --- a/example-plugins-basic/example-basic-2/pom.xml +++ b/example-plugins-basic/example-basic-2/pom.xml @@ -30,6 +30,7 @@ jar + ~\basic2-lib diff --git a/example-plugins-basic/pom.xml b/example-plugins-basic/pom.xml index 90c68bd..7cf7ccc 100644 --- a/example-plugins-basic/pom.xml +++ b/example-plugins-basic/pom.xml @@ -22,7 +22,7 @@ 4.13 2.5.6 - 3.0.1 + 3.0.2 3.1.1 diff --git a/example-plugins-cloud/pom.xml b/example-plugins-cloud/pom.xml index 5f9de1e..cc0a2fc 100644 --- a/example-plugins-cloud/pom.xml +++ b/example-plugins-cloud/pom.xml @@ -21,7 +21,7 @@ 4.13 2.3.12.RELEASE - 3.0.1 + 3.0.2 3.1.1 diff --git a/example-plugins-db/pom.xml b/example-plugins-db/pom.xml index 73038bd..fae9217 100644 --- a/example-plugins-db/pom.xml +++ b/example-plugins-db/pom.xml @@ -21,7 +21,7 @@ 1.18.10 4.13 - 3.0.1 + 3.0.2 2.5.6 3.1.1 -- Gitee From 91cffa16ac2345dd977fd39cd4b149ae100783c3 Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Wed, 4 May 2022 12:19:14 +0800 Subject: [PATCH 2/5] update to 3.0.2 --- example-main/pom.xml | 1 - example-plugins-basic/example-basic-1/pom.xml | 3 +-- example-plugins-basic/example-basic-2/pom.xml | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/example-main/pom.xml b/example-main/pom.xml index aff13dc..18314f3 100644 --- a/example-main/pom.xml +++ b/example-main/pom.xml @@ -117,7 +117,6 @@ com.gitee.starblues.example.Application jar - D:\etc\test-jar\lib diff --git a/example-plugins-basic/example-basic-1/pom.xml b/example-plugins-basic/example-basic-1/pom.xml index 6b46bd0..8d971c6 100644 --- a/example-plugins-basic/example-basic-1/pom.xml +++ b/example-plugins-basic/example-basic-1/pom.xml @@ -30,8 +30,7 @@ basic1-config.yaml - jar-outer - ~\basic1-lib + jar diff --git a/example-plugins-basic/example-basic-2/pom.xml b/example-plugins-basic/example-basic-2/pom.xml index 6d6cdc0..5536f26 100644 --- a/example-plugins-basic/example-basic-2/pom.xml +++ b/example-plugins-basic/example-basic-2/pom.xml @@ -30,7 +30,6 @@ jar - ~\basic2-lib -- Gitee From 241dc5ecb90ef23a312e2c0904b1a61456b10fdc Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Sat, 28 May 2022 13:17:26 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=B03.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example-main/pom.xml | 17 +-- .../gitee/starblues/example/Application.java | 2 +- .../example/config/Swagger2Config.java | 104 +++++++++--------- .../src/main/resources/application-dev.yml | 2 + .../{MainUserMapper.xml => AutowiredType.xml} | 0 example-plugins-basic/example-basic-1/pom.xml | 3 +- .../example/basic1/rest/CallerController.java | 9 +- .../example/basic1/service/BasicService.java | 7 ++ example-plugins-basic/example-basic-2/pom.xml | 1 - example-plugins-basic/pom.xml | 5 +- example-plugins-cloud/pom.xml | 3 +- ...PluginUserMapper.xml => AutowiredType.xml} | 0 example-plugins-db/pom.xml | 5 +- pom.xml | 3 + 14 files changed, 87 insertions(+), 74 deletions(-) rename example-main/src/main/resources/mapper/{MainUserMapper.xml => AutowiredType.xml} (100%) rename example-plugins-db/example-mybatis-plus/src/main/resources/mapper/{MpPluginUserMapper.xml => AutowiredType.xml} (100%) diff --git a/example-main/pom.xml b/example-main/pom.xml index 18314f3..8897dd2 100644 --- a/example-main/pom.xml +++ b/example-main/pom.xml @@ -16,12 +16,9 @@ 1.8 - 3.0.2 - - 2.5.6 - 3.5.0 2.2 + 2.0.9 @@ -72,11 +69,17 @@ - com.github.xiaoymin - knife4j-spring-boot-starter - 2.0.7 + io.swagger + swagger-annotations + 1.6.5 + + + + + + com.baomidou diff --git a/example-main/src/main/java/com/gitee/starblues/example/Application.java b/example-main/src/main/java/com/gitee/starblues/example/Application.java index 9b46a54..47d27e9 100644 --- a/example-main/src/main/java/com/gitee/starblues/example/Application.java +++ b/example-main/src/main/java/com/gitee/starblues/example/Application.java @@ -19,7 +19,7 @@ public class Application implements SpringBootstrap { } @Override - public void run(String[] args) throws Exception { + public void run(String[] args) { SpringApplication.run(Application.class, args); } } diff --git a/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java b/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java index 974aae8..025e210 100644 --- a/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java +++ b/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java @@ -1,52 +1,52 @@ -package com.gitee.starblues.example.config; - -import io.swagger.annotations.Api; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.*; -import springfox.documentation.service.*; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; - -import java.util.function.Predicate; - -/** - * Swagger2 配置 - * 访问地址:http:127.0.0.1:port/doc.html - * 文档说明:https://doc.xiaominfo.com/knife4j/ - * @author starBlues - * @version 1.0 - */ -@Configuration -@EnableSwagger2WebMvc -public class Swagger2Config { - - @Value("${server.port}") - private String port; - - - @Bean(value = "defaultApi2") - public Docket defaultApi2() { - Predicate predicate = PathSelectors.any(); - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .groupName("dev") - .select() - .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) - .paths(predicate) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("接口文档") - .description("接口说明文档") - .termsOfServiceUrl("http://ip:" + port + "/**") - .contact(new Contact("starBlues", "", "")) - .version("1.0.0-SNAPSHOT") - .build(); - } - -} +//package com.gitee.starblues.example.config; +// +//import io.swagger.annotations.Api; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.*; +//import springfox.documentation.service.*; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +//import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; +// +//import java.util.function.Predicate; +// +///** +// * Swagger2 配置 +// * 访问地址:http:127.0.0.1:port/doc.html +// * 文档说明:https://doc.xiaominfo.com/knife4j/ +// * @author starBlues +// * @version 1.0 +// */ +//@Configuration +//@EnableSwagger2WebMvc +//public class Swagger2Config { +// +// @Value("${server.port}") +// private String port; +// +// +// @Bean(value = "defaultApi2") +// public Docket defaultApi2() { +// Predicate predicate = PathSelectors.any(); +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(apiInfo()) +// .groupName("dev") +// .select() +// .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) +// .paths(predicate) +// .build(); +// } +// +// private ApiInfo apiInfo() { +// return new ApiInfoBuilder() +// .title("接口文档") +// .description("接口说明文档") +// .termsOfServiceUrl("http://ip:" + port + "/**") +// .contact(new Contact("starBlues", "", "")) +// .version("1.0.0-SNAPSHOT") +// .build(); +// } +// +//} diff --git a/example-main/src/main/resources/application-dev.yml b/example-main/src/main/resources/application-dev.yml index af2aa5e..bb3edf5 100644 --- a/example-main/src/main/resources/application-dev.yml +++ b/example-main/src/main/resources/application-dev.yml @@ -32,6 +32,8 @@ plugin: sortInitPluginIds: - example-basic-2 - example-basic-1 + disablePluginIds: + - example-basic-1 decrypt: enable: true className: com.gitee.starblues.common.cipher.AesPluginCipher diff --git a/example-main/src/main/resources/mapper/MainUserMapper.xml b/example-main/src/main/resources/mapper/AutowiredType.xml similarity index 100% rename from example-main/src/main/resources/mapper/MainUserMapper.xml rename to example-main/src/main/resources/mapper/AutowiredType.xml diff --git a/example-plugins-basic/example-basic-1/pom.xml b/example-plugins-basic/example-basic-1/pom.xml index 8d971c6..02b3d8d 100644 --- a/example-plugins-basic/example-basic-1/pom.xml +++ b/example-plugins-basic/example-basic-1/pom.xml @@ -15,7 +15,6 @@ - com.gitee.starblues spring-brick-maven-packager @@ -30,7 +29,7 @@ basic1-config.yaml - jar + jar-outer diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java index df35f5b..df9a8b0 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java @@ -3,11 +3,14 @@ package com.gitee.starblues.example.basic1.rest; import com.gitee.starblues.example.basic1.config.BasicConfig; import com.gitee.starblues.example.basic1.service.ServiceCaller; import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.sql.DataSource; +import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -25,8 +28,12 @@ public class CallerController { @Resource private ServiceCaller serviceCaller; + @Autowired + private DataSource dataSource; + @GetMapping("/test") - public BasicConfig caller(){ + public BasicConfig caller() throws SQLException { + System.out.println(dataSource.getConnection().getClientInfo()); String hello = serviceCaller.hello("hello, i am basic"); System.out.println(hello); return serviceCaller.getConfig("hi, i am basic1"); diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java index 23c63fb..ec05d73 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java @@ -1,6 +1,8 @@ package com.gitee.starblues.example.basic1.service; +import com.gitee.starblues.bootstrap.annotation.AutowiredType; import com.gitee.starblues.core.descriptor.PluginDescriptor; +import com.gitee.starblues.example.service.MainUserService; import com.gitee.starblues.example.service.TestAnnotation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -19,7 +21,12 @@ public class BasicService { @Autowired private PluginDescriptor pluginDescriptor; + @Autowired + @AutowiredType(AutowiredType.Type.PLUGIN_MAIN) + private MainUserService mainUserService; + public String getName(){ + System.out.println(mainUserService.getById(1)); return BasicService.class.getName(); } diff --git a/example-plugins-basic/example-basic-2/pom.xml b/example-plugins-basic/example-basic-2/pom.xml index 5536f26..23d80a5 100644 --- a/example-plugins-basic/example-basic-2/pom.xml +++ b/example-plugins-basic/example-basic-2/pom.xml @@ -14,7 +14,6 @@ - com.gitee.starblues spring-brick-maven-packager diff --git a/example-plugins-basic/pom.xml b/example-plugins-basic/pom.xml index 7cf7ccc..068a1da 100644 --- a/example-plugins-basic/pom.xml +++ b/example-plugins-basic/pom.xml @@ -18,12 +18,9 @@ example-basic-2 - 1.18.10 + 1.18.24 4.13 - 2.5.6 - 3.0.2 - 3.1.1 diff --git a/example-plugins-cloud/pom.xml b/example-plugins-cloud/pom.xml index cc0a2fc..6cf7a45 100644 --- a/example-plugins-cloud/pom.xml +++ b/example-plugins-cloud/pom.xml @@ -17,11 +17,10 @@ - 1.18.10 + 1.18.24 4.13 2.3.12.RELEASE - 3.0.2 3.1.1 diff --git a/example-plugins-db/example-mybatis-plus/src/main/resources/mapper/MpPluginUserMapper.xml b/example-plugins-db/example-mybatis-plus/src/main/resources/mapper/AutowiredType.xml similarity index 100% rename from example-plugins-db/example-mybatis-plus/src/main/resources/mapper/MpPluginUserMapper.xml rename to example-plugins-db/example-mybatis-plus/src/main/resources/mapper/AutowiredType.xml diff --git a/example-plugins-db/pom.xml b/example-plugins-db/pom.xml index fae9217..7a85873 100644 --- a/example-plugins-db/pom.xml +++ b/example-plugins-db/pom.xml @@ -18,12 +18,9 @@ example-mybatis-plus - 1.18.10 + 1.18.24 4.13 - 3.0.2 - 2.5.6 - 3.1.1 diff --git a/pom.xml b/pom.xml index 1079527..37cb55d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,9 @@ 1.8 + + 3.0.3 + 2.5.6 -- Gitee From 9df3cd1e82ea72b83cecec4611fc7daaae2076e0 Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Sun, 29 May 2022 12:23:49 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example-main/pom.xml | 12 +- .../example/config/Swagger2Config.java | 104 +++++++++--------- .../src/main/resources/application-dev.yml | 2 - .../example/basic1/service/BasicService.java | 1 - 4 files changed, 55 insertions(+), 64 deletions(-) diff --git a/example-main/pom.xml b/example-main/pom.xml index 8897dd2..2cde56d 100644 --- a/example-main/pom.xml +++ b/example-main/pom.xml @@ -69,17 +69,11 @@ - io.swagger - swagger-annotations - 1.6.5 + com.github.xiaoymin + knife4j-spring-boot-starter + ${knife4j.version} - - - - - - com.baomidou diff --git a/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java b/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java index 025e210..974aae8 100644 --- a/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java +++ b/example-main/src/main/java/com/gitee/starblues/example/config/Swagger2Config.java @@ -1,52 +1,52 @@ -//package com.gitee.starblues.example.config; -// -//import io.swagger.annotations.Api; -//import org.springframework.beans.factory.annotation.Value; -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.Configuration; -//import springfox.documentation.builders.*; -//import springfox.documentation.service.*; -//import springfox.documentation.spi.DocumentationType; -//import springfox.documentation.spring.web.plugins.Docket; -//import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; -// -//import java.util.function.Predicate; -// -///** -// * Swagger2 配置 -// * 访问地址:http:127.0.0.1:port/doc.html -// * 文档说明:https://doc.xiaominfo.com/knife4j/ -// * @author starBlues -// * @version 1.0 -// */ -//@Configuration -//@EnableSwagger2WebMvc -//public class Swagger2Config { -// -// @Value("${server.port}") -// private String port; -// -// -// @Bean(value = "defaultApi2") -// public Docket defaultApi2() { -// Predicate predicate = PathSelectors.any(); -// return new Docket(DocumentationType.SWAGGER_2) -// .apiInfo(apiInfo()) -// .groupName("dev") -// .select() -// .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) -// .paths(predicate) -// .build(); -// } -// -// private ApiInfo apiInfo() { -// return new ApiInfoBuilder() -// .title("接口文档") -// .description("接口说明文档") -// .termsOfServiceUrl("http://ip:" + port + "/**") -// .contact(new Contact("starBlues", "", "")) -// .version("1.0.0-SNAPSHOT") -// .build(); -// } -// -//} +package com.gitee.starblues.example.config; + +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.*; +import springfox.documentation.service.*; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; + +import java.util.function.Predicate; + +/** + * Swagger2 配置 + * 访问地址:http:127.0.0.1:port/doc.html + * 文档说明:https://doc.xiaominfo.com/knife4j/ + * @author starBlues + * @version 1.0 + */ +@Configuration +@EnableSwagger2WebMvc +public class Swagger2Config { + + @Value("${server.port}") + private String port; + + + @Bean(value = "defaultApi2") + public Docket defaultApi2() { + Predicate predicate = PathSelectors.any(); + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .groupName("dev") + .select() + .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + .paths(predicate) + .build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("接口文档") + .description("接口说明文档") + .termsOfServiceUrl("http://ip:" + port + "/**") + .contact(new Contact("starBlues", "", "")) + .version("1.0.0-SNAPSHOT") + .build(); + } + +} diff --git a/example-main/src/main/resources/application-dev.yml b/example-main/src/main/resources/application-dev.yml index bb3edf5..af2aa5e 100644 --- a/example-main/src/main/resources/application-dev.yml +++ b/example-main/src/main/resources/application-dev.yml @@ -32,8 +32,6 @@ plugin: sortInitPluginIds: - example-basic-2 - example-basic-1 - disablePluginIds: - - example-basic-1 decrypt: enable: true className: com.gitee.starblues.common.cipher.AesPluginCipher diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java index ec05d73..5569043 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java @@ -13,7 +13,6 @@ import org.springframework.stereotype.Service; * @version 1.0 * @since 2021-08-01 */ -@Component @Service @TestAnnotation public class BasicService { -- Gitee From 807f660b28a8cecafb12d6911cd7aead93548350 Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Sun, 5 Jun 2022 12:44:08 +0800 Subject: [PATCH 5/5] update 3.0.3 --- example-main/pom.xml | 5 +++++ .../mapper/{AutowiredType.xml => AutowiredTypeDefiner.xml} | 0 .../com/gitee/starblues/example/basic1/Basic1Plugin.java | 3 ++- .../starblues/example/basic1/rest/CallerController.java | 2 ++ .../starblues/example/basic1/rest/MainUserController.java | 2 ++ .../starblues/example/basic1/service/BasicService.java | 2 +- example-plugins-db/example-jpa/pom.xml | 4 ++-- .../java/com/gitee/starblues/example/mp/config/Config.java | 6 ++++-- .../mapper/{AutowiredType.xml => MpPluginUserMapper.xml} | 0 9 files changed, 18 insertions(+), 6 deletions(-) rename example-main/src/main/resources/mapper/{AutowiredType.xml => AutowiredTypeDefiner.xml} (100%) rename example-plugins-db/example-mybatis-plus/src/main/resources/mapper/{AutowiredType.xml => MpPluginUserMapper.xml} (100%) diff --git a/example-main/pom.xml b/example-main/pom.xml index 2cde56d..510a032 100644 --- a/example-main/pom.xml +++ b/example-main/pom.xml @@ -74,6 +74,11 @@ ${knife4j.version} + + org.springframework.boot + spring-boot-starter-quartz + + com.baomidou diff --git a/example-main/src/main/resources/mapper/AutowiredType.xml b/example-main/src/main/resources/mapper/AutowiredTypeDefiner.xml similarity index 100% rename from example-main/src/main/resources/mapper/AutowiredType.xml rename to example-main/src/main/resources/mapper/AutowiredTypeDefiner.xml diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/Basic1Plugin.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/Basic1Plugin.java index 86e313b..9709ee2 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/Basic1Plugin.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/Basic1Plugin.java @@ -3,6 +3,7 @@ package com.gitee.starblues.example.basic1; import com.gitee.starblues.bootstrap.SpringPluginBootstrap; import com.gitee.starblues.bootstrap.annotation.DisablePluginWeb; import com.gitee.starblues.bootstrap.annotation.OneselfConfig; +import com.gitee.starblues.bootstrap.realize.AutowiredTypeDefiner; import com.gitee.starblues.example.Application; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration; @@ -17,10 +18,10 @@ import java.net.URL; * @since 2021-08-01 */ @SpringBootApplication +@OneselfConfig(mainConfigFileName = {"application.yml", "application-dev.yml"}) public class Basic1Plugin extends SpringPluginBootstrap { public static void main(String[] args) { new Basic1Plugin().run(Application.class, args); } - } diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java index df9a8b0..5a62dbb 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/CallerController.java @@ -1,5 +1,6 @@ package com.gitee.starblues.example.basic1.rest; +import com.gitee.starblues.bootstrap.annotation.AutowiredType; import com.gitee.starblues.example.basic1.config.BasicConfig; import com.gitee.starblues.example.basic1.service.ServiceCaller; import io.swagger.annotations.Api; @@ -29,6 +30,7 @@ public class CallerController { private ServiceCaller serviceCaller; @Autowired + @AutowiredType(value = AutowiredType.Type.MAIN) private DataSource dataSource; @GetMapping("/test") diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/MainUserController.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/MainUserController.java index 9ebc02a..cea0d47 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/MainUserController.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/rest/MainUserController.java @@ -1,5 +1,6 @@ package com.gitee.starblues.example.basic1.rest; +import com.gitee.starblues.bootstrap.annotation.AutowiredType; import com.gitee.starblues.example.entity.MainUser; import com.gitee.starblues.example.service.MainUserService; import io.swagger.annotations.Api; @@ -21,6 +22,7 @@ import java.util.List; public class MainUserController { @Autowired + @AutowiredType(value = AutowiredType.Type.MAIN) private MainUserService mainUserService; diff --git a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java index 5569043..1e51eb3 100644 --- a/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java +++ b/example-plugins-basic/example-basic-1/src/main/java/com/gitee/starblues/example/basic1/service/BasicService.java @@ -21,7 +21,7 @@ public class BasicService { private PluginDescriptor pluginDescriptor; @Autowired - @AutowiredType(AutowiredType.Type.PLUGIN_MAIN) + @AutowiredType(value = AutowiredType.Type.MAIN) private MainUserService mainUserService; public String getName(){ diff --git a/example-plugins-db/example-jpa/pom.xml b/example-plugins-db/example-jpa/pom.xml index 7bb0509..211433f 100644 --- a/example-plugins-db/example-jpa/pom.xml +++ b/example-plugins-db/example-jpa/pom.xml @@ -18,12 +18,12 @@ org.springframework.boot spring-boot-starter-quartz - 2.5.0 + ${spring-boot.version} org.springframework.boot spring-boot-starter-data-jpa - 2.5.0 + ${spring-boot.version} diff --git a/example-plugins-db/example-mybatis-plus/src/main/java/com/gitee/starblues/example/mp/config/Config.java b/example-plugins-db/example-mybatis-plus/src/main/java/com/gitee/starblues/example/mp/config/Config.java index 72d94db..b267f4a 100644 --- a/example-plugins-db/example-mybatis-plus/src/main/java/com/gitee/starblues/example/mp/config/Config.java +++ b/example-plugins-db/example-mybatis-plus/src/main/java/com/gitee/starblues/example/mp/config/Config.java @@ -1,6 +1,7 @@ package com.gitee.starblues.example.mp.config; -import com.gitee.starblues.bootstrap.realize.MainEnvironmentProvider; +import com.gitee.starblues.bootstrap.PluginContextHolder; +import com.gitee.starblues.spring.environment.EnvironmentProvider; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.springframework.context.annotation.Bean; @@ -14,7 +15,8 @@ import org.springframework.context.annotation.Configuration; public class Config { @Bean - public HikariDataSource dataSource(MainEnvironmentProvider environmentProvider){ + public HikariDataSource dataSource(){ + EnvironmentProvider environmentProvider = PluginContextHolder.getEnvironmentProvider(); // 从主程序获取配置 String url = environmentProvider.getString("spring.datasource.url"); String username = environmentProvider.getString("spring.datasource.username"); diff --git a/example-plugins-db/example-mybatis-plus/src/main/resources/mapper/AutowiredType.xml b/example-plugins-db/example-mybatis-plus/src/main/resources/mapper/MpPluginUserMapper.xml similarity index 100% rename from example-plugins-db/example-mybatis-plus/src/main/resources/mapper/AutowiredType.xml rename to example-plugins-db/example-mybatis-plus/src/main/resources/mapper/MpPluginUserMapper.xml -- Gitee