Skip to content

Commit

Permalink
Merge pull request #1465 from lilai23/classloader
Browse files Browse the repository at this point in the history
set PluginClassLoader for plugin config
  • Loading branch information
Sherlockhan authored Mar 26, 2024
2 parents bafe18c + 970fd59 commit 48ab598
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 48ab598

Please sign in to comment.