I think i have to be more specific for a solid advice :)

I guess the thing I don't understnad is how to transit from singleton 
servlet to request scoped objects
for eg I have a singleton servlet to process a request, to use request 
scoped object i have to use a provider class. 
(https://github.com/google/guice/wiki/Scopes#scopes-and-concurrency)

but the provider class need inject of request scope object as well (eg 
httpservletrequest), ie:

@Singleton
public class Servlethandler ... {
    @Inject
    Provider<RequestScopeObj> obj
}

public class RSprovider {
    @Inject
    public RSprovider(HttpServletRequest req) {...}
}

As servlet handler is singleton, i don't understand how to request scope 
object would work.

On Tuesday, May 19, 2015 at 7:46:34 PM UTC+8, klc wrote:
>
> Would this need the injector?
>
> On Tuesday, May 19, 2015 at 7:03:10 PM UTC+8, scl wrote:
>>
>>  You can bind the object in request scope.
>>
>>
>>
>> On 05/19/2015 12:43 PM, klc wrote:
>>  
>> Hi all I have a servlet app that read a configuration file on settings of 
>> different services (>1000), like auto commit. 
>> And when a request come in, it use this configuration to create a per 
>> request context object for services to use.
>>
>>  Now for the context object i can use assisted inject to create them by 
>> factory. but how do I re-inject them in services, instead of passing them 
>> explicitly?
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "google-guice" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/google-guice.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-guice/c39f19b4-8830-4c3b-89ad-e3e0e4680c06%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-guice/c39f19b4-8830-4c3b-89ad-e3e0e4680c06%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>  

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/b689bab1-93dd-47bc-84a1-7213103be4ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to