Ohh and forgot to mention that it is guice 1.0
2009/11/24 nino martinez wael <[email protected]>
> I know about providers and we are using them alot.
>
> However I fail to see how I can tell a provider to use a specific instance
> only for that request. Should the pseudo code be something like this:
>
>
> public myclass(SpecialObject specialObject )
> {
> --->provider.setInstance(SpecialObject);
> InjectorCreator.InjectMembers(
> this);
> }
>
> How would I get the provider? And how would I makes sure it were only in
> the current request so we don't get mixed instances over requests..?
>
> regards Nino
>
>
>
> 2009/11/24 Anton Gavazuk <[email protected]>
>
> you can use a Provider and it will take care creating/getting required
>> instance for injection.
>>
>> 2009/11/24 nino martinez wael <[email protected]>
>>
>>> Hi
>>>
>>> A couple days ago I wrote to the forum, but I don't think my mail came
>>> through.
>>>
>>> I have a case where only the code that needs injection can provide one of
>>> the objects that needs to be injected :(
>>>
>>> The code looks something like this:
>>>
>>> Myclass
>>>
>>> public myclass(SpecialObject specialObject )
>>> {
>>> --->
>>> InjectorCreator.InjectMembers(this);
>>> }
>>>
>>> @inject
>>> public void setController(Controller controller){
>>>
>>> }
>>>
>>> And lastly the controller class:
>>>
>>> Controller{
>>>
>>> @inject
>>> public void setSpecialObject(SpecialObject specialObject ){
>>>
>>> }
>>>
>>> .. @inject a lot of other stuff too
>>>
>>> }
>>>
>>> So my question are can I somehow make Guice aware of the SpecialObject
>>> instance at the ---> marker?
>>>
>>> Further the instance reference has to be requestscoped or at least only
>>> use the specified instance for the current request only, myclass will only
>>> be instantiated once per request .
>>>
>>> Regards Nino
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "google-guice" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<google-guice%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-guice?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-guice%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.