diff --git a/pom.xml b/pom.xml
index 5df6ef751672a1a156a381adfc09d971f543fd07..23ca7cda17f330ee59d09750c74298a2bcdfb316 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,8 +29,49 @@
1.8
UTF-8
3.8.1
+
+ 3.1.0
+ 3.1.0
+ 3.1.0
+ 1.6
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ https://gitee.com/starblues/springboot-plugin-framework-parent
+ scm:https://gitee.com/starblues/springboot-plugin-framework-parent.git
+ scm:https://gitee.com/starblues/springboot-plugin-framework-parent.git
+ 1.0
+
+
+
+
+ sonatype-nexus-snapshots
+ oss Snapshots Repository
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ sonatype-nexus-staging
+ oss Staging Repository
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+
+ StarBlues
+ starblues@foxmail.com
+ https://gitee.com/starblues/
+
+
+
@@ -42,8 +83,106 @@
${java.version}
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ ${maven-assembly-plugin.version}
+
+
+ jar-with-dependencies
+
+ ${project.artifactId}-${project.version}
+ false
+ false
+
+
+ true
+ true
+
+
+
+
+
+ make-assembly
+ package
+
+ single
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ package
+
+ jar-no-fork
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+ ${plugin.skip}
+
+
+
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ ${maven-gpg-plugin.version}
+
+ ${plugin.skip}
+
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+
+ dev
+
+ true
+
+
+ true
+
+
+
+
+ release
+
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-plugin-framework-common/src/main/java/com/gitee/starblues/utils/ObjectUtils.java b/spring-plugin-framework-common/src/main/java/com/gitee/starblues/utils/ObjectUtils.java
index 4ec35ae1bbf79e316d81132069fa70e8e4562ae6..ba1baca9e73aeb386015fea1c5db717b40d0eb80 100644
--- a/spring-plugin-framework-common/src/main/java/com/gitee/starblues/utils/ObjectUtils.java
+++ b/spring-plugin-framework-common/src/main/java/com/gitee/starblues/utils/ObjectUtils.java
@@ -423,6 +423,11 @@ public class ObjectUtils {
return count;
}
+ public static String changePackageToMatch(String packageName){
+ Assert.isNotEmpty(packageName, "参数 packageName 不能为空");
+ return packageName.replace(".", "/") + "/**";
+ }
+
private static boolean containsText(CharSequence str) {
int strLen = str.length();
for (int i = 0; i < strLen; i++) {
diff --git a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/ConfigurePluginEnvironment.java b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/ConfigurePluginEnvironment.java
index ea0bae35e67f405b9ce38ab00208b56bf10e89b6..c159c6e9b470648b34f8885e72c18d9f2c539328 100644
--- a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/ConfigurePluginEnvironment.java
+++ b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/ConfigurePluginEnvironment.java
@@ -73,8 +73,8 @@ class ConfigurePluginEnvironment {
env.put(SPRING_JMX_UNIQUE_NAMES, true);
env.put(SPRING_ADMIN_JMX_NAME, SPRING_ADMIN_JMX_VALUE + pluginId);
env.put(REGISTER_SHUTDOWN_HOOK_PROPERTY, false);
- env.put(MBEAN_DOMAIN_PROPERTY_NAME, null);
- environment.getPropertySources().addLast(new MapPropertySource(PLUGIN_PROPERTY_NAME, env));
+ env.put(MBEAN_DOMAIN_PROPERTY_NAME, pluginId);
+ environment.getPropertySources().addFirst(new MapPropertySource(PLUGIN_PROPERTY_NAME, env));
if(processorContext.runMode() == ProcessorContext.RunMode.ONESELF){
ConfigureMainPluginEnvironment configureMainPluginEnvironment =
diff --git a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/EmptyMainApplicationContext.java b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/EmptyMainApplicationContext.java
index 7b677469853cd105b387772ae95b1a7ed59e9497..53a55368e9971b990a1ed3c039d4ede5e69f721f 100644
--- a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/EmptyMainApplicationContext.java
+++ b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/EmptyMainApplicationContext.java
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.ObjectProvider;
import org.springframework.core.ResolvableType;
import java.lang.annotation.Annotation;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
@@ -45,4 +46,9 @@ public class EmptyMainApplicationContext implements MainApplicationContext {
public void close() throws Exception {
}
+
+ @Override
+ public Map> getConfigurableEnvironment() {
+ return Collections.emptyMap();
+ }
}
diff --git a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/processor/FrameDefineBeanProcessor.java b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/processor/FrameDefineBeanProcessor.java
index b4c6549182214e2c075d579466a8026f24932587..56fcb6af01916a9de51eaf1c8c57d56230c3229a 100644
--- a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/processor/FrameDefineBeanProcessor.java
+++ b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/processor/FrameDefineBeanProcessor.java
@@ -17,6 +17,9 @@
package com.gitee.starblues.bootstrap.processor;
+import com.gitee.starblues.bootstrap.realize.DefaultMainEnvironmentProvider;
+import com.gitee.starblues.bootstrap.realize.EmptyMainEnvironmentProvider;
+import com.gitee.starblues.bootstrap.realize.MainEnvironmentProvider;
import com.gitee.starblues.core.descriptor.InsidePluginDescriptor;
import com.gitee.starblues.integration.AutoIntegrationConfiguration;
import com.gitee.starblues.integration.ExtendPointConfiguration;
@@ -36,11 +39,17 @@ public class FrameDefineBeanProcessor implements SpringPluginProcessor {
InsidePluginDescriptor pluginDescriptor = context.getPluginDescriptor();
ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
beanFactory.registerSingleton("pluginDescriptor", pluginDescriptor.toPluginDescriptor());
+ beanFactory.registerSingleton("mainApplicationContext", context.getMainApplicationContext());
+ MainEnvironmentProvider mainEnvironmentProvider = null;
if(context.runMode() == ProcessorContext.RunMode.ONESELF){
beanFactory.registerSingleton("integrationConfiguration", new AutoIntegrationConfiguration());
applicationContext.registerBean(ExtendPointConfiguration.class);
+ mainEnvironmentProvider = new EmptyMainEnvironmentProvider();
+ } else {
+ mainEnvironmentProvider = new DefaultMainEnvironmentProvider(context.getMainApplicationContext());
}
+ beanFactory.registerSingleton("mainEnvironmentProvider", mainEnvironmentProvider);
}
@Override
diff --git a/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/realize/DefaultMainEnvironmentProvider.java b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/realize/DefaultMainEnvironmentProvider.java
new file mode 100644
index 0000000000000000000000000000000000000000..8487d3664dd6c607272685cccc47dd56471c2aaf
--- /dev/null
+++ b/springboot-plugin-bootstrap/src/main/java/com/gitee/starblues/bootstrap/realize/DefaultMainEnvironmentProvider.java
@@ -0,0 +1,123 @@
+/**
+ * Copyright [2019-2022] [starBlues]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gitee.starblues.bootstrap.realize;
+
+import com.gitee.starblues.loader.utils.ObjectUtils;
+import com.gitee.starblues.spring.MainApplicationContext;
+
+import java.util.Map;
+import java.util.function.Function;
+
+/**
+ * 主程序配置信息提供者默认实现
+ *
+ * @author starBlues
+ * @version 3.0.0
+ */
+public class DefaultMainEnvironmentProvider implements MainEnvironmentProvider{
+
+ private final MainApplicationContext mainApplicationContext;
+
+ public DefaultMainEnvironmentProvider(MainApplicationContext mainApplicationContext) {
+ this.mainApplicationContext = mainApplicationContext;
+ }
+
+ @Override
+ public Object getValue(String name) {
+ Map> configurableEnvironment = mainApplicationContext.getConfigurableEnvironment();
+ if(ObjectUtils.isEmpty(configurableEnvironment)){
+ return null;
+ }
+ for (Map.Entry> entry : configurableEnvironment.entrySet()) {
+ Map value = entry.getValue();
+ Object o = value.get(name);
+ if(o != null){
+ return o;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getString(String name) {
+ return getValue(name, String::valueOf);
+ }
+
+ @Override
+ public Integer getInteger(String name) {
+ return getValue(name, value -> {
+ if(value instanceof Integer){
+ return (Integer) value;
+ }
+ return Integer.parseInt(String.valueOf(value));
+ });
+ }
+
+ @Override
+ public Long getLong(String name) {
+ return getValue(name, value -> {
+ if(value instanceof Long){
+ return (Long) value;
+ }
+ return Long.parseLong(String.valueOf(value));
+ });
+ }
+
+ @Override
+ public Double getDouble(String name) {
+ return getValue(name, value -> {
+ if(value instanceof Double){
+ return (Double) value;
+ }
+ return Double.parseDouble(String.valueOf(value));
+ });
+ }
+
+ @Override
+ public Float getFloat(String name) {
+ return getValue(name, value -> {
+ if(value instanceof Float){
+ return (Float) value;
+ }
+ return Float.parseFloat(String.valueOf(value));
+ });
+ }
+
+ @Override
+ public Boolean getBoolean(String name) {
+ return getValue(name, value -> {
+ if(value instanceof Boolean){
+ return (Boolean) value;
+ }
+ return Boolean.parseBoolean(String.valueOf(value));
+ });
+ }
+
+ @Override
+ public Map> getAll() {
+ return mainApplicationContext.getConfigurableEnvironment();
+ }
+
+ private T getValue(String name, Function