Grails Command object @PostConstruct or something? -


i want initialize command field injected service.

so need execute command's method after has been initialized, before params assigned fields.

how can it? ok, can service bean hand in constructor. better way?

had no luck @postconstruct or initializingbean - looks command not bean, right?

grails 1.3.5

you're right command not bean. instantiate command instance service method , initialization there , return instance controller. call controller's binddata returned instance this:

// controller code def myservice // injected  def action = {     def command = myserivce.createcommandinstance()      binddata(command, params) }  // service code class myservice {     def createcommandinstance() {        def cmd = new mycommand()        dosomeinitializationwithcommand(cmd)        return cmd     } } 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -