|
I have defined some parameters in config.groovy, and access them from some controllers. I'd like to be able to change the parameters on the fly in config.groovy to modify the controllers behavior without having to manually edit those controllers or restart the server. But the controllers aren't reloaded and see the old values that were in config.groovy when the server started.
Is there any way to force them to reload (all at once if possible)? |
|
On 22/06/2012 09:09, gatherer wrote:
> I have defined some parameters in config.groovy, and access them from some > controllers. I'd like to be able to change the parameters on the fly in > config.groovy to modify the controllers behavior without having to manually > edit those controllers or restart the server. But the controllers aren't > reloaded and see the old values that were in config.groovy when the server > started. > > Is there any way to force them to reload (all at once if possible)? There are a couple of plugins that can help with this, http://grails.org/plugin/external-config-reload appears to be the more recently updated. Ian -- Ian Roberts | Department of Computer Science [hidden email] | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I don't know if I'm missing something, but I can't see how to reload all the controllers with this plugin.
|
|
On 22/06/2012 11:37, gatherer wrote:
> I don't know if I'm missing something, but I can't see how to reload all the > controllers with this plugin. You shouldn't need to "reload" the controllers as such. The plugin watches for changes to your external configuration files, and when any of them change it re-reads them and updates the grailsApplication.config to match. So any code in your controllers that reads grailsApplication.config.foo.bar will see the updated values. And since controllers are (by default) prototype scoped, a new instance is created for each request and any non-static initialization code will see the latest values. Ian -- Ian Roberts | Department of Computer Science [hidden email] | University of Sheffield, UK --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I believe it works with non-prototype scoped artefacts as well such as services, etc. At least that's the way I designed it :)
On Fri, Jun 22, 2012 at 4:50 AM, Ian Roberts <[hidden email]> wrote:
|
|
In reply to this post by Ian Roberts
Does this mean scaffolded controllers will be regenerated too?
|
|
The controllers do not need to be reloaded - the configuration in
grailsApplication.config (a central location) simply gets updated and the exact same controllers will get the new configuration the next time they use grailsApplication.config. Hopefully that helps to clear it up. -Brian -----Original Message----- From: gatherer [mailto:[hidden email]] Sent: Monday, June 25, 2012 3:35 AM To: [hidden email] Subject: [grails-user] Re: Is there a way to reload all controllers? Does this mean scaffolded controllers will be regenerated too? -- View this message in context: http://grails.1312388.n4.nabble.com/Is-there-a-way-to-reload-all-controlle rs-tp4630540p4630596.html Sent from the Grails - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
