bootstrapping - Grails instantiates object and uses in Controllers -



bootstrapping - Grails instantiates object and uses in Controllers -

i have application needs instantiate 1 object, thinking of singleton, before jump in that, thinking of dependency injection. is, instantiate object , setattribute servletcontext in bootstrap.groove , utilize object in every controller. understanding bootstrap called 1 time during application lifetime? that?

you can define singleton beans in resources.groovy

beans = { mybean(my.company.mybeanimpl) { singleton true } }

then in controllers

class examplecontroller { def mybean }

all documented here: http://www.grails.org/doc/latest/guide/14.%20grails%20and%20spring.html

grails bootstrapping

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -