chore: keep the pluginWrapper bean for compatibility (#6271)

#### What type of PR is this?
/area core
/milestone 2.18.x

#### What this PR does / why we need it:
为了平滑升级先保留 PluginWrapper 的 Bean

#### Does this PR introduce a user-facing change?
```release-note
None
```
pull/6276/head
guqing 2024-07-05 12:08:37 +08:00 committed by GitHub
parent ad66247872
commit 138d52e731
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
package run.halo.app.plugin;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.pf4j.Plugin;
import org.springframework.lang.NonNull;
/**
* This class will be extended by all plugins and serve as the common class between a plugin and
@ -11,10 +11,11 @@ import org.springframework.lang.NonNull;
* @author guqing
* @since 2.0.0
*/
@Getter
@Slf4j
public class BasePlugin extends Plugin {
protected final PluginContext context;
protected PluginContext context;
/**
* Constructor a plugin with the given plugin context.
@ -25,8 +26,6 @@ public class BasePlugin extends Plugin {
this.context = pluginContext;
}
@NonNull
public PluginContext getContext() {
return context;
public BasePlugin() {
}
}

View File

@ -85,6 +85,7 @@ public class DefaultPluginApplicationContextFactory implements PluginApplication
sw.start("RegisterBeans");
var beanFactory = context.getBeanFactory();
beanFactory.registerSingleton("pluginWrapper", pluginWrapper);
context.registerBean(AggregatedRouterFunction.class);
if (pluginWrapper.getPlugin() instanceof SpringPlugin springPlugin) {