From 47157ddd3fc2b709e1cfbfecf74f4e749172a40e Mon Sep 17 00:00:00 2001 From: John Niang Date: Wed, 26 Jun 2024 23:46:50 +0800 Subject: [PATCH] Fix the problem of not being able to autowire settingFetcher bean in plugin (#6156) #### What type of PR is this? /kind bug /area core /area plugin #### What this PR does / why we need it: The problem was introduced by PR . That PR wrongly registered `settingFetcher` singleton bean. #### Which issue(s) this PR fixes: image #### Does this PR introduce a user-facing change? ```release-note None ``` --- .../app/plugin/DefaultPluginApplicationContextFactory.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/application/src/main/java/run/halo/app/plugin/DefaultPluginApplicationContextFactory.java b/application/src/main/java/run/halo/app/plugin/DefaultPluginApplicationContextFactory.java index d77916c48..0d29e3290 100644 --- a/application/src/main/java/run/halo/app/plugin/DefaultPluginApplicationContextFactory.java +++ b/application/src/main/java/run/halo/app/plugin/DefaultPluginApplicationContextFactory.java @@ -1,6 +1,5 @@ package run.halo.app.plugin; -import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_SINGLETON; import static org.springframework.util.ResourceUtils.CLASSPATH_URL_PREFIX; import java.io.IOException; @@ -102,9 +101,8 @@ public class DefaultPluginApplicationContextFactory implements PluginApplication rootContext.getBeanProvider(ReactiveExtensionClient.class) .ifUnique(client -> { - context.registerBean("reactiveSettingFetcher", - DefaultReactiveSettingFetcher.class, bhd -> bhd.setScope(SCOPE_SINGLETON)); - beanFactory.registerSingleton("settingFetcher", DefaultSettingFetcher.class); + context.registerBean("reactiveSettingFetcher", DefaultReactiveSettingFetcher.class); + context.registerBean("settingFetcher", DefaultSettingFetcher.class); }); rootContext.getBeanProvider(PluginRequestMappingHandlerMapping.class)