|
Hi guys,
I'm creating a Menu static class to handle menus in my app. I'd like to setup the menu structure in the Config.groovy file. What's the preferred way to access grailsApplication from a static method in grails 2.0 now that ConfigurationHolder is deprecated?
Many thanks, G Gianluca Sartori -- Cell. +39 347 0494840 |
|
On 22/11/2011 11:23, Gianluca Sartori wrote:
> Hi guys, > > I'm creating a Menu static class to handle menus in my app. I'd like to > setup the menu structure in the Config.groovy file. > What's the preferred way to access grailsApplication from a static > method in grails 2.0 now that ConfigurationHolder is deprecated? The preferred option if at all possible is to refactor your code so you don't need to... Does this have to be static or could it be a singleton service (which you can autowire into other artefacts and access from GSP views and layouts using ${grailsApplication.mainContext.menuService.whatever()})? 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 |
|
That could be a service, definitely. Tnx for the hint Ian!
G Gianluca Sartori -- Cell. +39 347 0494840 On Tue, Nov 22, 2011 at 12:41 PM, Ian Roberts <[hidden email]> wrote:
|
|
I guess you've decided to follow a different path, but anyway if you still need to know how to access the grailsApplication from a static method, take a look at Burt's blog post here http://burtbeckwith.com/blog/?p=993 and especially at the comments where I'm asking a related quesiton.
In addition, since you're trying to handle menus in your app, you might be interested in the navigation plugin: http://grails.org/plugin/navigation Regards, Dimitris On Tue, Nov 22, 2011 at 4:39 PM, Gianluca Sartori [via Grails] <[hidden email]> wrote: That could be a service, definitely. Tnx for the hint Ian! |
| Powered by Nabble | Edit this page |
