Created
July 23, 2013 14:11
-
-
Save sergiomichels/6062659 to your computer and use it in GitHub Desktop.
Hook into the mssageSource declaration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.codehaus.groovy.grails.context.support.PluginAwareResourceBundleMessageSource | |
| import com.wordpress.sergiosmind.i18n.ExposedKeysMessageSource | |
| class MyGrailsPlugin { | |
| ... | |
| def doWithSpring = { | |
| def beanconf = springConfig.getBeanConfig('messageSource') | |
| def beandef = beanconf ? beanconf.beanDefinition : springConfig.getBeanDefinition('messageSource') | |
| if (beandef?.beanClassName == PluginAwareResourceBundleMessageSource.class.canonicalName) { | |
| //just change the target class of the bean, maintaining all configurations. | |
| beandef.beanClassName = ExposedKeysMessageSource.class.canonicalName | |
| } | |
| } | |
| ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now it does not work anymore with Grails 3.3