@groovy.transform.CompileStatic abstract class Plugin extends java.lang.Object implements ApplicationContextAware, GrailsApplicationAware, GrailsApplicationLifeCycle, PluginManagerAware
Super class for plugins to implement. Plugin implementations should define the various plugin hooks (doWithSpring, doWithApplicationContext, doWithDynamicMethods etc.)
| Modifiers | Name | Description |
|---|---|---|
boolean |
enabled |
Whether the plugin is enabled |
| Type | Name and description |
|---|---|
ConfigurableApplicationContext |
applicationContext |
java.util.List<ArtefactHandler> |
artefactsList of ArtefactHandler instances provided by this plugin |
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 |
|---|---|---|
|
BeanRegistrar |
beanRegistrar()Sub classes should override to register beans with the Spring Framework org.springframework.beans.factory.BeanRegistry using a org.springframework.beans.factory.BeanRegistrar. |
|
void |
beans(groovy.lang.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. |
|
groovy.lang.Closure |
doWithSpring()Sub classes should override to provide implementations |
|
void |
doWithSpring(BeanBuilder beans)Registers Spring beans directly against the supplied BeanBuilder. |
|
ConfigurableApplicationContext |
getApplicationContext()
|
|
Config |
getConfig()
|
|
GrailsPluginManager |
getManager()The GrailsPluginManager instance |
|
void |
onChange(java.util.Map<java.lang.String, java.lang.Object> event)Invoked when a object this plugin is watching changes |
|
void |
onConfigChange(java.util.Map<java.lang.String, java.lang.Object> event)Invoked when the application configuration changes |
|
void |
onShutdown(java.util.Map<java.lang.String, java.lang.Object> event)Invoked when the ApplicationContext is closed |
|
void |
onStartup(java.util.Map<java.lang.String, java.lang.Object> event) |
|
void |
setApplicationContext(ApplicationContext applicationContext) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
List of ArtefactHandler instances provided by this plugin
The current Grails Environment
The GrailsApplication instance
The GrailsPlugin definition for this plugin
The GrailsPluginManager instance
Sub classes should override to register beans with the Spring Framework org.springframework.beans.factory.BeanRegistry using a org.springframework.beans.factory.BeanRegistrar. This is the modern, Spring-native replacement for the doWithSpring() bean builder DSL.
The returned registrar is applied before Spring Boot auto-configuration is processed, so
beans registered here take precedence over Boot's @ConditionalOnMissingBean defaults.
null if none (the default)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
Registers Spring beans directly against the supplied BeanBuilder. This is the statically-compilable alternative to doWithSpring(): instead of returning a closure whose delegate the container wires up, an implementation registers beans against the builder passed as an argument. Subclasses should override. A plugin should override either this method or doWithSpring(), but not both: the two forms are alternatives, and defining both causes the plugin to fail to load.
beans - The BeanBuilder to register beans against
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