What does init do in modules {} ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

What does init do in modules {} ?

uris77
Please correct me. I'm assuming that when we have an init block inside a bindings block, the init block is executed everytime a request is made.

ratpack {
  bindings {
     init {
     }
  }
}
rus
Reply | Threaded
Open this post in threaded view
|

Re: What does init do in modules {} ?

rus

It runs once, when the injector is finalized

On 4 Aug 2014 20:22, "uris77 [via Ratpack Forum]" <[hidden email]> wrote:
Please correct me. I'm assuming that when we have an init block inside a modules block, the init block is executed everytime a request is made.

ratpack {
  modules {
     init {
     }
  }
}


If you reply to this email, your message will be added to the discussion below:
http://forum.ratpack.io/What-does-init-do-in-modules-tp577.html
To start a new topic under Ratpack Forum, email [hidden email]
To unsubscribe from Ratpack Forum, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: What does init do in modules {} ?

Luke Daley
Administrator
That’s right. 

If you want something to run for every request, put a handler at the start of the pipeline.
Reply | Threaded
Open this post in threaded view
|

Re: What does init do in modules {} ?

uris77
Thank you. I needed exactly what it does. Thanks again.