public static interface Request.Module
Jooby give you an extension point in order to register scope requested objects, here is how do you usually do it.
class MyModule implements Jooby.Module { void configure(env env, Config config, Binder binder) { Multibinder b = Multibinder.newSetBinder(binder, RequestModule.class); b.addBinding().toInstance(requestBinder -> { b.bind(MyService.class).to(...); }) } }
You don't. Request scoped object are useful if you need/want to have a single instance of an object per request. A good example of such object is a db session, bc you want to reuse the session during the request execution.
If you don't need/have that requirement. You shouldn't use request scoped object and just work with prototype objects, as Guice suggest.
Modifier and Type | Method and Description |
---|---|
void |
configure(com.google.inject.Binder binder) |
Copyright © 2015. All rights reserved.