From 67500f9844c22b65c65e1521862a004584d893e2 Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Fri, 26 May 2023 19:05:04 +0800 Subject: [PATCH] Grails Plugin Core: Support reloading spring resources.groovy when changed --- .../org/grails/plugins/core/CoreGrailsPlugin.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/grails-plugin-core/src/main/groovy/org/grails/plugins/core/CoreGrailsPlugin.groovy b/grails-plugin-core/src/main/groovy/org/grails/plugins/core/CoreGrailsPlugin.groovy index e8b8eb6053..307daf429a 100644 --- a/grails-plugin-core/src/main/groovy/org/grails/plugins/core/CoreGrailsPlugin.groovy +++ b/grails-plugin-core/src/main/groovy/org/grails/plugins/core/CoreGrailsPlugin.groovy @@ -139,6 +139,14 @@ class CoreGrailsPlugin extends Plugin implements PriorityOrdered { applicationContext.registerBeanDefinition(beanName, xmlBeans.getBeanDefinition(beanName)) } } + if (res.filename.endsWith('.groovy')) { + Map variables = [ + application: grailsApplication, + grailsApplication: grailsApplication] as Map + RuntimeSpringConfiguration springConfig = new DefaultRuntimeSpringConfiguration() + RuntimeSpringConfigUtilities.reloadSpringResourcesConfig(springConfig, variables, res) + springConfig.registerBeansWithContext(applicationContext) + } } else if (event.source instanceof Class) { def clazz = (Class) event.source