ratpack / ratpack

Lean & powerful HTTP apps
https://ratpack.io
Other
1.94k stars 396 forks source link

Allow the global handlers {} block in scripts to accept Guice beans #94

Closed ldaley closed 11 years ago

ldaley commented 11 years ago

As a mechanism for making things globally accessible…

ratpack {
  modules {
    // add some modules
  }
  handlers { SomeService someService ->
    get("foo") {
      someService.method()
    }
    post("bar") {
      someService.method()
    }      
  }
}

Where SomeService is bound by a module.

ldaley commented 11 years ago

There's a little bit of an unresolved issue here.

Users will try and grab contextual things this way, the most significant of which probably being TemplateRenderer. Will just have to make sure the docs on this are clear.