What happens if I take https://code.google.com/p/google-guice/wiki/CustomInjections and change:

field.isAnnotationPresent(InjectLogger.class)

    to

field.isAnnotationPresent(Inject.class)

    Wouldn't that work as I expect?

Gili

On 27/10/2013 11:53 AM, Sam Berlin wrote:
Issue 49 <https://code.google.com/p/google-guice/issues/detail?id=49> provides a good history of this request -- currently closed as "Won't Fix".

 sam


On Sun, Oct 27, 2013 at 11:45 AM, cowwoc <[email protected] <mailto:[email protected]>> wrote:

    Hi Sam,

        Out of curiosity, is it possible to make this work using
    @Inject instead of @InjectLogger? As in:

    @Inject Logger logger;

        The goal is to intercept @Inject for an unknown type, and ask
    HK2 to try injection. Using custom annotations kind of defeat the
    purpose (we already have @HK2Inject which we're trying to get away
    from).

    Gili


    On 27/10/2013 11:24 AM, Sam Berlin wrote:
    There's no built-in way to do this.  Depending on the scope, it's
    maybe possible to use TypeListeners and custom injections
    <https://code.google.com/p/google-guice/wiki/CustomInjections> to
    do this.

     sam


    On Sun, Oct 27, 2013 at 11:19 AM, Gili <[email protected]
    <mailto:[email protected]>> wrote:

        I am trying to integrate two DI systems: Guice and HK2. I'd
        like to implement the following behavior:

        1. When Injector.getInstance() is invoked, iterate through
        all bindings (as it normally does).
        2. If no match is found, ask HK2 to inject the type.
        3. If no match is found, throw an error.

        I'm not sure how to implement step #2. Because we lack this
        behavior, we're stuck with an ugly @HK2Inject as seen here:
        https://hk2.java.net/guice-bridge/index.html

        Any ideas?

        Gili
-- 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]
        <mailto:google-guice%[email protected]>.
        To post to this group, send email to
        [email protected]
        <mailto:[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/YXJuAdw5G24/unsubscribe.
    To unsubscribe from this group and all its topics, send an email
    to [email protected]
    <mailto:[email protected]>.

    To post to this group, send email to
    [email protected] <mailto:[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]
    <mailto:google-guice%[email protected]>.
    To post to this group, send email to [email protected]
    <mailto:[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/YXJuAdw5G24/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