Plug-in factory
Plug-in factories are divided into two types. One is encapsulated in the form of a module and is automatically built according to the configuration parameters when the YMP framework is initialized. It is called the default plug-in factory (there can be only one default factory instance). , the other is a custom plug-in factory built through manual configuration of code. The difference is that the default plug-in factory is more closely integrated with the framework, and the two modes can coexist;
Default plug-in Factory
The default plug-in factory is automatically created when the plug-in module is initialized by the YMP framework. Its initialization parameters and description are as follows:
#------------------------------------- # Plugin插件模块初始化参数 #------------------------------------- # 插件主目录路径,可选参数,默认值为${root}/plugins ymp.configs.plugin.plugin_home= # 自动扫描包路径集合,多个包名之间用'|'分隔,默认与框架自动扫描的包路径相同 ymp.configs.plugin.autoscan_packages= # 插件是否自动启动,默认为true ymp.configs.plugin.automatic= # 是否加载当前CLASSPATH内的所有包含插件配置文件的JAR包,默认为true ymp.configs.plugin.included_classpath=
Disabled The method of the default plug-in factory:
# 在YMP框架配置文件中找到"模块排除列表"项,添加插件模块的名称,如: ymp.excluded_modules=plugin
The method of calling the default plug-in factory:
Plugins.get().getPluginFactory();
Event listening method of the default plug-in factory:
The default plug-in factory is processed through the event service subscription of the YMP framework. The PluginEvent plug-in event object includes the following event types:
Transaction type | Description |
---|---|
PLUGIN_INITED | Plug-in initialization event |
PLUGIN_STARTED | Plug-in start event |
PLUGIN_SHUTDOWN | Plug-in stop event |
PLUGIN_DESTROYED | Plug-in destruction event |