> getConfigurableEnvironment();
-
/**
* 得到主程序配置的 Provider
* @return EnvironmentProvider
*/
EnvironmentProvider getEnvironmentProvider();
+ /**
+ * 返回主程序配置的Profile配置
+ * @return String 数组
+ */
+ String[] getActiveProfiles();
+
+ /**
+ * 返回主程序默认的Profile配置
+ * @return String 数组
+ */
+ String[] getDefaultProfiles();
/**
* 从主程序获取依赖
@@ -64,4 +76,23 @@ public interface MainApplicationContext extends ApplicationContext {
*/
Object getSourceApplicationContext();
+ /**
+ * 是否能注册Controller
+ * @return boolean
+ */
+ boolean isRegisterController();
+
+ /**
+ * 获取主程序的 RequestMappingHandlerMapping
+ * @return RequestMappingHandlerMapping
+ */
+ RequestMappingHandlerMapping getRequestMappingHandlerMapping();
+
+ /**
+ * 获取主程序的 RequestMappingHandlerAdapter
+ * @return RequestMappingHandlerAdapter
+ */
+ RequestMappingHandlerAdapter getRequestMappingHandlerAdapter();
+
+
}
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/MainApplicationContextProxy.java b/spring-brick/src/main/java/com/gitee/starblues/spring/MainApplicationContextProxy.java
index f876ffece57eb64796cfb6b325e24f45f4f884f8..96f7b583388b7d9b68340dacaf320e45bf1a2231 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/MainApplicationContextProxy.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/MainApplicationContextProxy.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@ package com.gitee.starblues.spring;
import com.gitee.starblues.spring.environment.EnvironmentProvider;
import com.gitee.starblues.spring.environment.MainSpringBootEnvironmentProvider;
import com.gitee.starblues.utils.ObjectUtils;
+import com.gitee.starblues.utils.SpringBeanUtils;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
@@ -26,25 +28,31 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
/**
* 主程序 ApplicationContext 的实现
* @author starBlues
* @version 3.0.1
*/
+@Slf4j
public class MainApplicationContextProxy extends ApplicationContextProxy implements MainApplicationContext{
+ private final static String REQUEST_MAPPING_BANE_NAME = "requestMappingHandlerMapping";
+ private final static String REQUEST_MAPPING_ADAPTER_BANE_NAME = "requestMappingHandlerAdapter";
+
private final GenericApplicationContext applicationContext;
private final boolean isWebEnvironment;
+ private final boolean isRegisterController;
+ private final RequestMappingHandlerMapping requestMappingHandlerMapping;
+ private final RequestMappingHandlerAdapter requestMappingHandlerAdapter;
+
public MainApplicationContextProxy(GenericApplicationContext applicationContext) {
- super(applicationContext.getBeanFactory());
- this.applicationContext = applicationContext;
- this.isWebEnvironment = getIsWebEnvironment(applicationContext);
+ this(applicationContext, null);
}
public MainApplicationContextProxy(GenericApplicationContext applicationContext,
@@ -52,6 +60,22 @@ public class MainApplicationContextProxy extends ApplicationContextProxy impleme
super(applicationContext.getBeanFactory(), autoCloseable);
this.applicationContext = applicationContext;
this.isWebEnvironment = getIsWebEnvironment(applicationContext);
+ if(isWebEnvironment){
+ this.requestMappingHandlerMapping = SpringBeanUtils.getExistBean(
+ applicationContext, REQUEST_MAPPING_BANE_NAME, RequestMappingHandlerMapping.class);
+ this.requestMappingHandlerAdapter = SpringBeanUtils.getExistBean(
+ applicationContext, REQUEST_MAPPING_ADAPTER_BANE_NAME, RequestMappingHandlerAdapter.class);
+ if(this.requestMappingHandlerMapping == null || this.requestMappingHandlerAdapter == null){
+ log.error("主程序环境异常, 插件不能注册 Controller 接口!");
+ isRegisterController = false;
+ } else {
+ isRegisterController = true;
+ }
+ } else {
+ this.isRegisterController = false;
+ this.requestMappingHandlerMapping = null;
+ this.requestMappingHandlerAdapter = null;
+ }
}
@Override
@@ -81,6 +105,16 @@ public class MainApplicationContextProxy extends ApplicationContextProxy impleme
return new MainSpringBootEnvironmentProvider(applicationContext.getEnvironment());
}
+ @Override
+ public String[] getActiveProfiles() {
+ return applicationContext.getEnvironment().getActiveProfiles();
+ }
+
+ @Override
+ public String[] getDefaultProfiles() {
+ return applicationContext.getEnvironment().getDefaultProfiles();
+ }
+
@Override
public Object resolveDependency(String requestingBeanName, Class> dependencyType) {
try {
@@ -100,6 +134,21 @@ public class MainApplicationContextProxy extends ApplicationContextProxy impleme
return applicationContext;
}
+ @Override
+ public boolean isRegisterController() {
+ return isRegisterController;
+ }
+
+ @Override
+ public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
+ return requestMappingHandlerMapping;
+ }
+
+ @Override
+ public RequestMappingHandlerAdapter getRequestMappingHandlerAdapter() {
+ return requestMappingHandlerAdapter;
+ }
+
@Override
public Object getSourceBeanFactory() {
return applicationContext.getBeanFactory();
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/ProxyFactory.java b/spring-brick/src/main/java/com/gitee/starblues/spring/ProxyFactory.java
index 9ff2087a7692412a1f49d82f6462ed8a9503f303..e2c9db3501e7d00bc71514e010f2b6cacff8f882 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/ProxyFactory.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/ProxyFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/ResolvePluginThreadClassLoader.java b/spring-brick/src/main/java/com/gitee/starblues/spring/ResolvePluginThreadClassLoader.java
index f2191e979eb299e02512579b140d724fb94bbe41..dfd84e5ea32cb92a8a49831134066695463d38b0 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/ResolvePluginThreadClassLoader.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/ResolvePluginThreadClassLoader.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/SpringBeanFactory.java b/spring-brick/src/main/java/com/gitee/starblues/spring/SpringBeanFactory.java
index 545728f1059c6cbed658b04aed8c874d46d27cee..fed6f7ca4a0c9712e41eb79d487ed15b472a515c 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/SpringBeanFactory.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/SpringBeanFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/SpringPluginHook.java b/spring-brick/src/main/java/com/gitee/starblues/spring/SpringPluginHook.java
index 54a121df0a5fb8439b6e6a676ae504e9e2bf0985..bda373f27ca2dda141f095fe86e0615463f614f0 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/SpringPluginHook.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/SpringPluginHook.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/WebConfig.java b/spring-brick/src/main/java/com/gitee/starblues/spring/WebConfig.java
index a056f33bce5d528d3ecd856b10967bca3f265814..1cc006e35ed7c99854af31ffba1f383396c25b3f 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/WebConfig.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/WebConfig.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EmptyEnvironmentProvider.java b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EmptyEnvironmentProvider.java
index 69ca692d1c4d327f9d42bcdf4cbba9f9c4f65922..a9ed7b725d44516718d268b8a9cb94b06f766ea2 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EmptyEnvironmentProvider.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EmptyEnvironmentProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EnvironmentProvider.java b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EnvironmentProvider.java
index a4e1facb83aa4f4340098a90b66e4d9b5c90abc8..8ab6be9991fe45c98e2e7e8211997cca1dcc12ed 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EnvironmentProvider.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/EnvironmentProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MainSpringBootEnvironmentProvider.java b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MainSpringBootEnvironmentProvider.java
index 84106b311e1410101e580cb9460a4cc1130fcae4..e126ba748df852439dfe8555dfe8980c1612305f 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MainSpringBootEnvironmentProvider.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MainSpringBootEnvironmentProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MapEnvironmentProvider.java b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MapEnvironmentProvider.java
index 6a25cb14b55eba3eeafdd791377eacab9c3ec777..095462c908eee3b9ea5cb86fe84a4898fb6b9bd8 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MapEnvironmentProvider.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/environment/MapEnvironmentProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultExtractFactory.java b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultExtractFactory.java
index ed5d69bf75d92e0e6a5479c461c272b8296985fb..93d846f1108bea6de16c4fd10b1de6098268e55d 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultExtractFactory.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultExtractFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultOpExtractFactory.java b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultOpExtractFactory.java
index 73096b2efb8095f2253046cb674d08978dea14ea..0aacb0c658390578b25cce2511b465bf51bf9df2 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultOpExtractFactory.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/DefaultOpExtractFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractCoordinate.java b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractCoordinate.java
index 813998354556bd7a86614165948136db91aef11c..01755e9a2403833a654844bdc95b44b44a2c92f3 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractCoordinate.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractCoordinate.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractFactory.java b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractFactory.java
index 898c5727d5de2495740a9db4bc30a857aa2010f4..7090fa97ba1ffd11165bf024159b9d4c87b92367 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractFactory.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/ExtractFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/OpExtractFactory.java b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/OpExtractFactory.java
index 0a934b63208a618113673302d04cdad9e69a16ca..1ac04fae67b40d648f7beade0a4dad6c4addcf30 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/extract/OpExtractFactory.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/extract/OpExtractFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/DefaultInvokeSupperCache.java b/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/DefaultInvokeSupperCache.java
index 2917f8d79c6326c14f2fe7b024f4fe1fc472bd32..e993667373b2e8952a6be5e0526501d73c47f9d5 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/DefaultInvokeSupperCache.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/DefaultInvokeSupperCache.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/InvokeSupperCache.java b/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/InvokeSupperCache.java
index 8422c5c8ca00eb1dc78430fed22960e2d435af7b..5e8d9234435712ba5b91e238549a3bbdb2e41d91 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/InvokeSupperCache.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/InvokeSupperCache.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/SupperCache.java b/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/SupperCache.java
index de290f06ff7a3fb3ebc56d63cfe07089cd876be3..019aed04f12ebc3fdd2fd8f20ce633099e8d6e7b 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/SupperCache.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/invoke/SupperCache.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginResource.java b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginResource.java
index d7e9bf9c75c09c0c7c2c3321a521eb5b7442fa34..533137fc3b917b050d81fc2aea3fa9a5cdf8cf7d 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginResource.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginResource.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceConfig.java b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceConfig.java
index 75eeafd646c33b6c343bfb15105dc5d60bf60a9f..5be0e766a95f89b426d37abd4ce3419368e70133 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceConfig.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceConfig.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceResolver.java b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceResolver.java
index 09232f34992a652bd63a0fb90586a5d6b5fe753f..2d4243b453dd5b54d65f1234124ef3933fea8838 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceResolver.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceResolver.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceWebMvcConfigurer.java b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceWebMvcConfigurer.java
index 984a1984307cd2304c39292fae0d82474c2d371f..c04dc7f4435039499dd9e046eeb7821798303892 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceWebMvcConfigurer.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/web/PluginStaticResourceWebMvcConfigurer.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/PluginThymeleafInvolved.java b/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/PluginThymeleafInvolved.java
index 333f0afc32f9ef5ef10763dc1bea74b93b2ffaa0..350a3f92cae8389ef40f0336149eb205d43434d8 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/PluginThymeleafInvolved.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/PluginThymeleafInvolved.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/ThymeleafConfig.java b/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/ThymeleafConfig.java
index 479b1c7f62cb478f44df27e8587891683e51e058..a76ceadef1b3c2daeb2d02f61e20abeedd3095bd 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/ThymeleafConfig.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/spring/web/thymeleaf/ThymeleafConfig.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/AnnotationsUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/AnnotationsUtils.java
index 134725801d8b3f10615928b4d1dd49a191a82869..def02b2e5e24180a0025bbcce399cf3c88bb023a 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/AnnotationsUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/AnnotationsUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import java.lang.annotation.Annotation;
* 注解工具
*
* @author starBlues
+ * @since 3.0.0
* @version 3.0.0
*/
public class AnnotationsUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/ClassUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/ClassUtils.java
index 4ca552718d4e1f74c5a205ad3317caed9b5b6a16..3cb31897a7d4b0cca0798b412d11f2e4aeb1b1c4 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/ClassUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/ClassUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import java.util.Map;
* 类工具类
*
* @author starBlues
+ * @since 2.4.0
* @version 2.4.0
*/
public class ClassUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/LogUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/LogUtils.java
index c637552d6c06fff9f3d8b7e4638a2129e54a1a4d..ac9f5474065741d146e051669eab6e2c798c0543 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/LogUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/LogUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,10 @@ import com.gitee.starblues.core.descriptor.PluginDescriptor;
import org.slf4j.Logger;
/**
+ * 日志打印工具
+ *
* @author starBlues
+ * @since 3.0.0
* @version 3.0.0
*/
public class LogUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/MsgUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/MsgUtils.java
index ed4da06086fddbb1ad0529b4a8773ff8e26f0af5..16628b248cad110bc0cdbd1d0f8cd258666b3641 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/MsgUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/MsgUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,10 @@ package com.gitee.starblues.utils;
import com.gitee.starblues.core.descriptor.PluginDescriptor;
/**
+ * msg 工具
+ *
* @author starBlues
+ * @since 3.0.0
* @version 3.0.0
*/
public abstract class MsgUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/Order.java b/spring-brick/src/main/java/com/gitee/starblues/utils/Order.java
index 904c60ede569b2ea4f24a05d01994b4a5f085809..8f3e076b4f805c007a84aae5282bb3b418b8e8e4 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/Order.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/Order.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,8 @@ package com.gitee.starblues.utils;
/**
* 排序接口
* @author starBlues
- * @version 1.0
+ * @since 1.0.0
+ * @version 1.0.0
*/
public interface Order {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/OrderPriority.java b/spring-brick/src/main/java/com/gitee/starblues/utils/OrderPriority.java
index e96f4eb3c73696f6fc766a4eab8a605164d968db..bf4126fd8310d9e9628937e18ae888c3686e627a 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/OrderPriority.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/OrderPriority.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,8 @@ package com.gitee.starblues.utils;
* 顺序优先级
*
* @author starBlues
- * @version 1.0
+ * @since 1.0.0
+ * @version 1.0.0
*/
public class OrderPriority {
/**
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/OrderUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/OrderUtils.java
index ed154202dd626ba6c2e95270a0cf2e1dac103001..89720e81db70953ae435517e5565418805fe85dd 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/OrderUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/OrderUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import java.util.function.Function;
* 通用工具
*
* @author starBlues
+ * @since 3.0.0
* @version 3.0.0
*/
public class OrderUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/PluginConfigUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/PluginConfigUtils.java
index 961ce0946b727253e1f9d3eac01ae047d6c61007..d6d8657fbcfe88f636ff5fe864ddaf5b815c8714 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/PluginConfigUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/PluginConfigUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import com.gitee.starblues.integration.IntegrationConfiguration;
/**
* 插件配置工具类
* @author starBlues
+ * @since 3.0.0
* @version 3.0.0
*/
public class PluginConfigUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/PluginFileUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/PluginFileUtils.java
index fb01b0d94854edc0c23520f51455b7f13398b486..d3ee7843c869197b60ece580b81ccaeaf7263563 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/PluginFileUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/PluginFileUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/ScanUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/ScanUtils.java
index d80fed911a473b5fccb8a342983b9cd388644a02..0fb3bd1a7d2f004b1c3fd6fb53b1725d4c7f7551 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/ScanUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/ScanUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import java.util.stream.Stream;
*
* @author starBlues
* @version 2.2.2
+ * @version 2.2.2
*/
public class ScanUtils {
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanCustomUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanCustomUtils.java
index f44d7455d3dce7f3750a43aa9fa12a2bf260fc7a..2593e82a793e5857c81cb3803b7b3a888fff32d2 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanCustomUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanCustomUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package com.gitee.starblues.utils;
import com.gitee.starblues.spring.ApplicationContext;
import com.gitee.starblues.spring.SpringBeanFactory;
import org.springframework.util.ClassUtils;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import java.lang.annotation.Annotation;
import java.util.*;
@@ -26,7 +27,8 @@ import java.util.*;
/**
* 自定义插件bean工具类
* @author starBlues
- * @version 3.0.0
+ * @since 3.0.0
+ * @version 3.1.1
*/
public class SpringBeanCustomUtils {
@@ -94,6 +96,31 @@ public class SpringBeanCustomUtils {
}
}
+ /**
+ * 获取存在的Bean。名称和类型任意批量即可返回
+ * @param applicationContext applicationContext
+ * @param beanName bean名称
+ * @param beanClass bean class
+ * @return T
+ * @param bean 类型
+ */
+ public static T getExistBean(ApplicationContext applicationContext, String beanName, Class beanClass){
+ SpringBeanFactory springBeanFactory = applicationContext.getSpringBeanFactory();
+ Map beansOfTypeMap = springBeanFactory.getBeansOfType(beanClass);
+ if(ObjectUtils.isEmpty(beansOfTypeMap)){
+ return null;
+ }
+ Set> entries = beansOfTypeMap.entrySet();
+ for (Map.Entry entry : entries) {
+ String key = entry.getKey();
+ T value = entry.getValue();
+ if(Objects.equals(beanName, key) || Objects.equals(value.getClass().getName(), beanClass.getName())){
+ return value;
+ }
+ }
+ return null;
+ }
+
/**
* 通过注解获取bean
* @param applicationContext applicationContext
diff --git a/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanUtils.java b/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanUtils.java
index 8a971c90a7660d0c9007273215a3a3ff01cd53c5..5f4a9561a7888aad6912673a55d245567da37533 100644
--- a/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanUtils.java
+++ b/spring-brick/src/main/java/com/gitee/starblues/utils/SpringBeanUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,8 @@ import java.util.*;
/**
* 插件bean工具类
* @author starBlues
- * @version 3.0.0
+ * @since 3.0.0
+ * @version 3.1.1
*/
public class SpringBeanUtils {
@@ -88,6 +89,30 @@ public class SpringBeanUtils {
}
}
+ /**
+ * 获取存在的Bean。名称和类型任意批量即可返回
+ * @param applicationContext applicationContext
+ * @param beanName bean名称
+ * @param beanClass bean class
+ * @return T
+ * @param bean 类型
+ */
+ public static T getExistBean(ApplicationContext applicationContext, String beanName, Class beanClass){
+ Map beansOfTypeMap = applicationContext.getBeansOfType(beanClass);
+ if(ObjectUtils.isEmpty(beansOfTypeMap)){
+ return null;
+ }
+ Set> entries = beansOfTypeMap.entrySet();
+ for (Map.Entry entry : entries) {
+ String key = entry.getKey();
+ T value = entry.getValue();
+ if(beanName.equals(key) || Objects.equals(value.getClass().getName(), beanClass.getName())){
+ return value;
+ }
+ }
+ return null;
+ }
+
/**
* 通过注解获取bean
* @param applicationContext applicationContext
diff --git a/spring-brick/src/main/resources/META-INF/spring-configuration-metadata.json b/spring-brick/src/main/resources/META-INF/spring-configuration-metadata.json
index 67610e7b0fe6bd0ae08c1d01226751432b1b08de..2b65e6d2687a8873d21a23cae37fd32076af3ca2 100644
--- a/spring-brick/src/main/resources/META-INF/spring-configuration-metadata.json
+++ b/spring-brick/src/main/resources/META-INF/spring-configuration-metadata.json
@@ -95,11 +95,32 @@
},
{
"name": "plugin.exactVersion",
- "type": "java.lang.String",
+ "type": "java.lang.Boolean",
"sourceType": "com.gitee.starblues.integration.AutoIntegrationConfiguration",
"description": "是否完全匹配版本。设置为true表示插件设置的requires的版本号完全匹配version版本号才可允许插件安装, 即: requires=x.y.z; 设置为false表示插件设置的requires的版本号小于等于version值, 插件就可安装, 即requires<=x.y.z",
"defaultValue": false
},
+ {
+ "name": "plugin.pluginSwaggerScan",
+ "type": "java.lang.Boolean",
+ "sourceType": "com.gitee.starblues.integration.AutoIntegrationConfiguration",
+ "description": "是否扫描插件 swagger 接口",
+ "defaultValue": true
+ },
+ {
+ "name": "plugin.pluginFollowProfile",
+ "type": "java.lang.Boolean",
+ "sourceType": "com.gitee.starblues.integration.AutoIntegrationConfiguration",
+ "description": "插件的配置文件 Profile 是否跟随主程序的 Profile 配置动态切换",
+ "defaultValue": false
+ },
+ {
+ "name": "plugin.pluginFollowLog",
+ "type": "java.lang.Boolean",
+ "sourceType": "com.gitee.starblues.integration.AutoIntegrationConfiguration",
+ "description": "插件日志打印是否跟随主程序",
+ "defaultValue": false
+ },
{
"name": "plugin.decrypt",
"type": "com.gitee.starblues.integration.decrypt.DecryptConfiguration",
diff --git a/spring-brick/src/test/java/com/gitee/starblues/core/checker/DefaultPluginIsolationLauncherCheckerTest.java b/spring-brick/src/test/java/com/gitee/starblues/core/checker/DefaultPluginIsolationLauncherCheckerTest.java
index 559b996f3bd168b1a652b14f7d3827da6bcc6088..6bca70309aa593f4804e0e709a9c5cdcde7db6e1 100644
--- a/spring-brick/src/test/java/com/gitee/starblues/core/checker/DefaultPluginIsolationLauncherCheckerTest.java
+++ b/spring-brick/src/test/java/com/gitee/starblues/core/checker/DefaultPluginIsolationLauncherCheckerTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-brick/src/test/java/com/gitee/starblues/core/version/SemverVersionInspectorTest.java b/spring-brick/src/test/java/com/gitee/starblues/core/version/SemverVersionInspectorTest.java
index c8e87d72da807b603b99eb27f66c601116ca0534..2eaaf1200b1fc372a61350750c556bb308af6373 100644
--- a/spring-brick/src/test/java/com/gitee/starblues/core/version/SemverVersionInspectorTest.java
+++ b/spring-brick/src/test/java/com/gitee/starblues/core/version/SemverVersionInspectorTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright [2019-2022] [starBlues]
+ * Copyright [2019-Present] [starBlues]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/update.md b/update.md
index 3e8f5e913171e18ff32e9e20343ccf6e0a9dbb98..9ac1b24f33171b67fa917d68e53d2b05fcddc2fb 100644
--- a/update.md
+++ b/update.md
@@ -1,14 +1,8 @@
-1. 【新增】增加主包`MANIFEST.MF`中`title`和`version`定义, 标准jar包中包含`Implementation-Title`和`Implementation-Version`属性
-2. 【新增】新增根据个人需求选择开发模式,支持隔离式开发模式(目前已有的)、共享式开发模式
-3. 【新增】新增可自主实现扩展插件信息
-4. 【新增】新增插件停止类型
-3. 【修复】修复插件中`LiveBeansView`注册异常问题
-4. 【修复[#I5IFR4](https://gitee.com/starblues/springboot-plugin-framework-parent/issues/I5IFR3)】 `ExtractFactory#getExtractByCoordinate` 类型转换`Bug`
-5. 【修复[#I5GJO9](https://gitee.com/starblues/springboot-plugin-framework-parent/issues/I5GJO9)】`DefaultPluginManager#install` 异常无法抛出
-6. 【修复】修复插件无法加载其他包依赖中的`mybatis-xml`问题
-7. 【修复】修复插件子启动问题
-8. 【修复】修复插件`load`解压异常
-9. 【修复】修复`jar`、`zip`加载依赖时未使用`libDir`配置前缀
-10.【优化】优化插件`parse`后为`parsed`状态
-11.【优化】优化依赖资源默认不缓存, 以减少内存
-
+1. 【新增】主程序可通过`pluginInfo`对象获取插件的`ClassLoader`。
+2. 【新增】新增配置`plugin.pluginSwaggerScan`可禁用扫描插件的 `swagger` 接口。
+3. 【新增】插件配置文件`spring.profiles.active`的值可跟随主程序配置切换。
+4. 【新增】插件的日志可配置为跟随主程序日志配置打印。
+5. 【新增】补充常见打包的 `META-INF\MANIFEST.MF` 文件内容。
+6. 【优化】优化插件隔离模式下,内存占用过大的问题。
+7. 【修复[#I61INH](https://gitee.com/starblues/springboot-plugin-framework-parent/issues/I61INH)】修复`PluginUser#getBean(String name, boolean includeMainBeans)`返回的`Bean`错误
+
\ No newline at end of file