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 <https://github.com/halo-dev/halo/pull/6141>. That PR wrongly registered `settingFetcher` singleton bean.

#### Which issue(s) this PR fixes:

<img width="1920" alt="image" src="https://github.com/halo-dev/halo/assets/16865714/ecc67064-3506-49b8-8114-a145da549126">

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/6160/head v2.17.0-alpha.1
John Niang 2024-06-26 23:46:50 +08:00 committed by GitHub
parent 632bb69dfe
commit 47157ddd3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -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)