Package org.laxture.sbp
Class SpringBootPlugin
java.lang.Object
org.pf4j.Plugin
org.laxture.sbp.SpringBootPlugin
public abstract class SpringBootPlugin
extends org.pf4j.Plugin
Base Pf4j Plugin for Spring Boot.
----
### Following actions will be taken after plugin is started:
* Use
SpringBootstrap to initialize Spring environment
in spring-boot style. Some AutoConfiguration need to be excluded explicitly
to make sure plugin resource could be inject to main ApplicationContext
* Share beans from main ApplicationContext to
plugin ApplicationContext in order to share resources.
This is done by SpringBootstrap
* Register Controller and @RestController beans to
RequestMapping of main ApplicationContext, so Spring will forward
request to plugin controllers correctly.
* Register Extension to main ApplicationContext
----
### And following actions will be taken when plugin is stopped:
* Unregister Extension in main ApplicationContext
* Unregister controller beans from main RequestMapping
* Close plugin ApplicationContext- See Also:
-
Field Summary
Fields inherited from class org.pf4j.Plugin
log, wrapper -
Constructor Summary
ConstructorsConstructorDescriptionSpringBootPlugin(org.pf4j.PluginWrapper wrapper, IPluginConfigurer... pluginConfigurers) -
Method Summary
Modifier and TypeMethodDescriptionvoidafterPluginBootstrap(SpringBootstrap bootstrap, org.springframework.context.support.GenericApplicationContext pluginApplicationContext) protected abstract SpringBootstraporg.springframework.context.support.GenericApplicationContextorg.springframework.context.support.GenericApplicationContextvoidonPluginBootstrap(SpringBootstrap bootstrap, org.springframework.context.support.GenericApplicationContext pluginApplicationContext) voidregisterBeanToMainContext(String beanName, Object bean) static voidreleaseLegacyResources(org.pf4j.PluginWrapper plugin, org.springframework.context.support.GenericApplicationContext mainAppCtx) Clean legacy resources left behind by failed plugin starting.voidstart()voidstop()voidvoidunregisterBeanFromMainContext(String beanName) static voidunregisterBeanFromMainContext(org.springframework.context.support.GenericApplicationContext mainCtx, Object bean) static voidunregisterBeanFromMainContext(org.springframework.context.support.GenericApplicationContext mainCtx, String beanName) Methods inherited from class org.pf4j.Plugin
delete, getWrapper
-
Constructor Details
-
SpringBootPlugin
-
-
Method Details
-
start
public void start()- Overrides:
startin classorg.pf4j.Plugin
-
stop
public void stop()- Overrides:
stopin classorg.pf4j.Plugin
-
releaseLegacyResources
public static void releaseLegacyResources(org.pf4j.PluginWrapper plugin, org.springframework.context.support.GenericApplicationContext mainAppCtx) Clean legacy resources left behind by failed plugin starting. -
createSpringBootstrap
-
getApplicationContext
public org.springframework.context.support.GenericApplicationContext getApplicationContext() -
getPluginManager
-
getMainApplicationContext
public org.springframework.context.support.GenericApplicationContext getMainApplicationContext() -
registerBeanToMainContext
-
unregisterBeanFromMainContext
-
unregisterBeanFromMainContext
-
unregisterBeanFromMainContext
public static void unregisterBeanFromMainContext(org.springframework.context.support.GenericApplicationContext mainCtx, String beanName) -
unregisterBeanFromMainContext
public static void unregisterBeanFromMainContext(org.springframework.context.support.GenericApplicationContext mainCtx, Object bean) -
onPluginBootstrap
public void onPluginBootstrap(SpringBootstrap bootstrap, org.springframework.context.support.GenericApplicationContext pluginApplicationContext) -
afterPluginBootstrap
public void afterPluginBootstrap(SpringBootstrap bootstrap, org.springframework.context.support.GenericApplicationContext pluginApplicationContext) -
getExcludeConfigurations
-