@groovy.transform.CompileStatic @groovy.util.logging.Slf4j class GrailsApplicationPostProcessor extends java.lang.Object implements ApplicationContextAware, ApplicationListener<ApplicationContextEvent>, BeanDefinitionRegistryPostProcessor
A BeanDefinitionRegistryPostProcessor that enhances any ApplicationContext with plugin manager capabilities
| Modifiers | Name | Description |
|---|---|---|
protected ApplicationContext |
applicationContext |
|
protected boolean |
earlyPluginRegistrationRan |
|
protected GrailsPluginManager |
pluginManager |
| Type | Name and description |
|---|---|
static boolean |
RELOADING_ENABLED |
GrailsApplicationClass |
applicationClass |
java.lang.Class[] |
classes |
GrailsApplication |
grailsApplication |
GrailsApplicationLifeCycle |
lifeCycle |
boolean |
loadExternalBeans |
boolean |
reloadingEnabled |
| Constructor and description |
|---|
GrailsApplicationPostProcessor(GrailsApplicationLifeCycle lifeCycle, ApplicationContext applicationContext, PluginDiscovery pluginDiscovery, java.lang.Class[] classes) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
customizeGrailsApplication(GrailsApplication grailsApplication) |
|
protected final void |
initializeGrailsApplication(ApplicationContext applicationContext) |
|
protected void |
loadApplicationConfig()Registers conversion service converters and creates the PropertySourcesConfig that backs grailsApplication.config. |
|
void |
onApplicationEvent(ApplicationContextEvent event) |
|
protected void |
performGrailsInitializationSequence() |
|
void |
postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) |
|
void |
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) |
|
protected static void |
registerAnnotationConfigProcessorsForGeneratedArtifacts(BeanDefinitionRegistry registry)Restores the processors that read the injection annotations, when running on artifacts generated ahead of time. |
|
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) |
Registers conversion service converters and creates the PropertySourcesConfig
that backs grailsApplication.config.
Plugin configurations are loaded early by GrailsEnvironmentPostProcessor and are already present in the environment's property sources by the time this method runs. This method simply creates the PropertySourcesConfig from whatever property sources exist in the environment.
Restores the processors that read the injection annotations, when running on artifacts generated ahead of time.
Generating those artifacts normally makes these unnecessary: the generator reads the
annotations itself and writes the field and method access into the code it emits, which is why
a controller or a tag library arrives fully injected without them. It can only do that for a
bean whose implementation it can see, and a bean contributed as an interface built by a
supplier hides it -- the link generator is declared as LinkGenerator and built by a
closure, so the @Autowired field on the implementation is generated for by nobody.
Nothing fails at start-up; the first page that follows a link does.
Only the two that inject are restored. Registering the whole set would bring back the processor that reads configuration classes, and reading them again in a context whose configuration has already been generated makes a second definition for beans the generated code has already contributed.
They are registered under the names Spring uses itself, so a context that already has them keeps what it has, and a context running without generated artifacts is untouched.