Skip to content

Commit

Permalink
set PluginClassLoader for plugin config
Browse files Browse the repository at this point in the history
Signed-off-by: lilai <[email protected]>
  • Loading branch information
lilai23 committed Mar 14, 2024
1 parent d270273 commit ac949ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce
}

// 确保局部类加载器不是当前类加载器,否则会stackoverflow
if (loader != null && !this.equals(loader)) {
if (loader != null && !this.equals(loader) && !(loader instanceof ServiceClassLoader)) {
try {
clazz = loader.loadClass(name);
} catch (ClassNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ private PluginConfigManager() {
*/
public static void loadPluginConfigs(Plugin plugin) {
File pluginConfigFile = getPluginConfigFile(plugin.getPath());
ClassLoader classLoader =
plugin.getServiceClassLoader() != null ? plugin.getServiceClassLoader() : plugin.getPluginClassLoader();
ClassLoader classLoader = plugin.getPluginClassLoader();
for (BaseConfig config : ServiceLoader.load(PluginConfig.class, classLoader)) {
Class<? extends BaseConfig> pluginConfigCls = config.getClass();
String pluginConfigKey = ConfigKeyUtil.getCLTypeKey(ConfigKeyUtil.getTypeKey(pluginConfigCls),
Expand Down

0 comments on commit ac949ce

Please sign in to comment.