-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow plugin to listen the event the plugin has started (#6234)
#### What type of PR is this? /kind feature /area core /milestone 2.17.x #### What this PR does / why we need it: This PR add support for allowing plugin to listen the event that the plugin has started. Below is an example of listening the event in plugin: ```java @eventlistener void onPluginStartedEvent(PluginStartedEvent event) { // do something. } ``` See #5339 (comment) for more. #### Which issue(s) this PR fixes: Fixes #5339 (comment) #### Special notes for your reviewer: 1. Create a plugin, add the listener above and write some logs 2. Build and install the plugin 3. Start plugin and see the logs you wrote #### Does this PR introduce a user-facing change? ```release-note 支持在插件中监听已启动事件 ```
- Loading branch information
Showing
3 changed files
with
50 additions
and
36 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
api/src/main/java/run/halo/app/plugin/event/PluginStartedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package run.halo.app.plugin.event; | ||
|
||
import org.springframework.context.ApplicationEvent; | ||
|
||
/** | ||
* The event that is published when a plugin is really started, and is only for plugin internal use. | ||
* | ||
* @author johnniang | ||
* @since 2.17.0 | ||
*/ | ||
public class PluginStartedEvent extends ApplicationEvent { | ||
|
||
public PluginStartedEvent(Object source) { | ||
super(source); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
application/src/main/java/run/halo/app/plugin/event/HaloPluginStateChangedEvent.java
This file was deleted.
Oops, something went wrong.