Setting up Spring Aliases in a Grails plugin

There are two places in a plugin where you can define an alias, doWithSpring and doWithApplicationContext.

In doWithSpring there is a variable called springConfig which is a RuntimeSpringConfiguration. You can use it like this:

springConfig.addAlias "myAliasedName", "myBeanName"


In doWithApplicationContext you can use the applicationContext which is passed into the closure like this:

applicationContext.registerAlias("myBeanName", "myAliasedName")

0 comments: