it's short but clear reply. thanks sam.

发自我的 iPad

在 2013-6-24,20:33,Sam Berlin <[email protected]> 写道:

> +1 to using ProvisionListener over TypeListener, if all you're interested in 
> is "when is something being created by Guice".  TypeListener is more about 
> telling Guice you have some custom things you want analyzed/injected, so 
> they'll work of Guice's hooks (including injectMembers, MembersInjectors, 
> etc..).
> 
>  sam
> 
> 
> On Sun, Jun 16, 2013 at 6:57 PM, Tim Boudreau <[email protected]> wrote:
>> It is a thing which looks much more useful than it is :-)
>> 
>> I recall running across it when I was learning Guice and thinking "Ooh, this 
>> looks like it will be really handy!" (I was looking for something like Guice 
>> 3.1's ProvisionListener).  In practice, every time I have thought "Hey, this 
>> must be what TypeListener is good for" it turned out that I was thinking 
>> about whatever problem I was having wrong.
>> 
>> If you're new to Guice, you can most likely safely ignore it for a long 
>> time, probably forever.  It looks like a path that leads somewhere but my 
>> experience has been that there's never something you could do with it that 
>> you couldn't do in a more straightforward way without it.  You might use it 
>> if you wanted to trigger some work after something is injected, but that's 
>> only really useful if it's, say, a library class you don't control - if you 
>> wrote the class, there are simpler ways to do those things.
>> 
>> Rooting through my own code, I found one usage in some experimental code - 
>> http://j.mp/15aFlbV - to do some automatic MBean registration - and looking 
>> at it, I should have just used an eager singleton, so it's just a code-smell 
>> there.
>> 
>> Maybe someone else will have a brilliant example where it's actually useful.
>> 
>> -Tim
>> 
>> -- 
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "google-guice" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/google-guice/VSokCcnCybA/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to