diff --git a/sofa-ark-parent/core-impl/container/src/main/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceImpl.java b/sofa-ark-parent/core-impl/container/src/main/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceImpl.java index b380ca77a..399b51aa7 100644 --- a/sofa-ark-parent/core-impl/container/src/main/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceImpl.java +++ b/sofa-ark-parent/core-impl/container/src/main/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceImpl.java @@ -37,11 +37,9 @@ import com.alipay.sofa.ark.spi.service.plugin.PluginManagerService; import com.google.inject.Inject; import com.google.inject.Singleton; -import org.codehaus.plexus.util.CollectionUtils; import java.io.File; import java.io.IOException; -import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; @@ -216,13 +214,15 @@ private URL[] getMergedBizClassPath(URL[] bizArchiveUrls, URL[] extensionUrls) { private void resolveExportMapIfNecessary(BizModel bizModel, List dependentPlugins) { Set plugins = new HashSet<>(); - if (ArkConfigs.areAllPluginsVisibleForBiz()) { - plugins.addAll(pluginManagerService.getPluginsInOrder()); - } else if (dependentPlugins != null && !dependentPlugins.isEmpty()) { - for (String pluginName : dependentPlugins) { - Plugin plugin = pluginManagerService.getPluginByName(pluginName); - plugins.add(plugin); + if (ArkConfigs.isBizSpecifyDependentPluginsEnable()) { + if (dependentPlugins != null && !dependentPlugins.isEmpty()) { + for (String pluginName : dependentPlugins) { + Plugin plugin = pluginManagerService.getPluginByName(pluginName); + plugins.add(plugin); + } } + } else { + plugins.addAll(pluginManagerService.getPluginsInOrder()); } bizModel.setDependentPlugins(plugins); diff --git a/sofa-ark-parent/core-impl/container/src/test/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceTest.java b/sofa-ark-parent/core-impl/container/src/test/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceTest.java index 7a6d5c520..9294009c5 100644 --- a/sofa-ark-parent/core-impl/container/src/test/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceTest.java +++ b/sofa-ark-parent/core-impl/container/src/test/java/com/alipay/sofa/ark/container/service/biz/BizFactoryServiceTest.java @@ -68,7 +68,6 @@ public void test() throws Throwable { Plugin plugin = pluginFactoryService.createPlugin(FileUtils.file(samplePlugin.getFile())); pluginManagerService.registerPlugin(plugin); - System.setProperty(ALL_PLUGINS_VISIBLE_FOR_BIZ, Boolean.TRUE.toString()); URL sampleBiz = cl.getResource("sample-biz.jar"); Biz biz = bizFactoryService.createBiz(FileUtils.file(sampleBiz.getFile())); bizManagerService.registerBiz(biz); diff --git a/sofa-ark-parent/core/api/src/main/java/com/alipay/sofa/ark/api/ArkConfigs.java b/sofa-ark-parent/core/api/src/main/java/com/alipay/sofa/ark/api/ArkConfigs.java index 8de566b67..3c2f26b73 100644 --- a/sofa-ark-parent/core/api/src/main/java/com/alipay/sofa/ark/api/ArkConfigs.java +++ b/sofa-ark-parent/core/api/src/main/java/com/alipay/sofa/ark/api/ArkConfigs.java @@ -168,7 +168,7 @@ public static void setEmbedStaticBizEnable(boolean enable) { System.setProperty(Constants.EMBED_STATIC_BIZ_ENABLE, enable ? "true" : "false"); } - public static boolean areAllPluginsVisibleForBiz() { - return Boolean.getBoolean(Constants.ALL_PLUGINS_VISIBLE_FOR_BIZ); + public static boolean isBizSpecifyDependentPluginsEnable() { + return Boolean.getBoolean(Constants.BIZ_SPECIFY_DEPENDENT_PLUGINS_ENABLE); } } \ No newline at end of file diff --git a/sofa-ark-parent/core/spi/src/main/java/com/alipay/sofa/ark/spi/constant/Constants.java b/sofa-ark-parent/core/spi/src/main/java/com/alipay/sofa/ark/spi/constant/Constants.java index 8eacc8099..73b15497d 100644 --- a/sofa-ark-parent/core/spi/src/main/java/com/alipay/sofa/ark/spi/constant/Constants.java +++ b/sofa-ark-parent/core/spi/src/main/java/com/alipay/sofa/ark/spi/constant/Constants.java @@ -204,7 +204,7 @@ public class Constants { public final static String EMBED_STATIC_BIZ_IN_RESOURCE_ENABLE = "sofa.ark.embed.static.biz.in.resource.enable"; public final static String ACTIVATE_NEW_MODULE = "activate.new.module"; public final static String PLUGIN_CLASS_ISOLATION_ENABLE = "sofa.ark.plugin.class.isolation.enable"; - public final static String ALL_PLUGINS_VISIBLE_FOR_BIZ = "sofa.ark.all.plugins.visible.for.biz"; + public final static String BIZ_SPECIFY_DEPENDENT_PLUGINS_ENABLE = "sofa.ark.biz.specify.dependent.plugins.enable"; public final static String AUTO_UNINSTALL_WHEN_FAILED_ENABLE = "sofa.ark.auto.uninstall.when.failed.enable";