@CompileStatic abstract class Plugin extends Object implements GrailsApplicationAware, GrailsApplicationLifeCycle, ApplicationContextAware, PluginManagerAware
Super class for plugins to implement. Plugin implementations should define the various plugin hooks (doWithSpring, doWithApplicationContext, doWithDynamicMethods etc.)
| Type | Name and description |
|---|---|
ConfigurableApplicationContext |
applicationContext |
List<ArtefactHandler> |
artefactsList of ArtefactHandler instances provided by this plugin |
boolean |
enabledWhether the plugin is enabled |
Environment |
environmentThe current Grails Environment |
GrailsApplication |
grailsApplicationThe GrailsApplication instance |
GrailsPlugin |
pluginThe GrailsPlugin definition for this plugin |
GrailsPluginManager |
pluginManagerThe GrailsPluginManager instance |
| Constructor and description |
|---|
Plugin() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
beans(Closure beanDefinitions)Allows a plugin to define beans at runtime. |
|
void |
doWithApplicationContext()Invokes once the ApplicationContext has been refreshed and after {#doWithDynamicMethods()} is invoked. |
|
void |
doWithDynamicMethods()Invoked in a phase where plugins can add dynamic methods. |
|
Closure |
doWithSpring()Sub classes should override to provide implementations |
|
ConfigurableApplicationContext |
getApplicationContext()
|
|
Config |
getConfig()
|
|
GrailsPluginManager |
getManager()The GrailsPluginManager instance |
|
void |
onChange(Map<String, Object> event)Invoked when a object this plugin is watching changes |
|
void |
onConfigChange(Map<String, Object> event)Invoked when the application configuration changes |
|
void |
onShutdown(Map<String, Object> event)Invoked when the ApplicationContext is closed |
|
void |
onStartup(Map<String, Object> event) |
|
void |
setApplicationContext(ApplicationContext applicationContext) |
List of ArtefactHandler instances provided by this plugin
Whether the plugin is enabled
The current Grails Environment
The GrailsApplication instance
The GrailsPlugin definition for this plugin
The GrailsPluginManager instance
Allows a plugin to define beans at runtime. Used primarily for reloading in development mode
beanDefinitions - The bean definitionsInvokes once the ApplicationContext has been refreshed and after {#doWithDynamicMethods()} is invoked. Subclasses should override
Invoked in a phase where plugins can add dynamic methods. Subclasses should override
Sub classes should override to provide implementations
The GrailsPluginManager instance
Invoked when a object this plugin is watching changes
event - The eventInvoked when the application configuration changes
event - The eventInvoked when the ApplicationContext is closed
event - The event