Loading Spring XML Config Files in a Grails Plugin

If your Grails plugin needs to load Spring config from a JAR that it depends on you can do this is the doWithApplicationContext hook.

def doWithApplicationContext = { applicationContext ->

XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
xmlReader.loadBeanDefinitions(new ClassPathResource("foo-config.xml"));
}

0 comments: