From 532d7e0632a8efa6946eebdd6d40174c456078a3 Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Mon, 26 Jun 2023 21:31:59 +0800 Subject: [PATCH] refactor: register plugin application context after context refreshed (#4092) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /area core /area plugin #### What this PR does / why we need it: 插件的 ApplicationContext 刷新之后在注册到 Registry 中 #### Does this PR introduce a user-facing change? ```release-note None ``` --- .../java/run/halo/app/plugin/PluginApplicationInitializer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/run/halo/app/plugin/PluginApplicationInitializer.java b/application/src/main/java/run/halo/app/plugin/PluginApplicationInitializer.java index 924110a46..c17ae31f3 100644 --- a/application/src/main/java/run/halo/app/plugin/PluginApplicationInitializer.java +++ b/application/src/main/java/run/halo/app/plugin/PluginApplicationInitializer.java @@ -95,7 +95,6 @@ public class PluginApplicationInitializer { log.debug("Total millis: {} ms -> {}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint()); - contextRegistry.register(pluginId, pluginApplicationContext); return pluginApplicationContext; } @@ -126,6 +125,8 @@ public class PluginApplicationInitializer { pluginApplicationContext.refresh(); stopWatch.stop(); + contextRegistry.register(pluginId, pluginApplicationContext); + log.debug("initApplicationContext total millis: {} ms -> {}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint()); }