You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Lasse Lindgård (JIRA)" <ji...@apache.org> on 2011/09/19 16:19:08 UTC

[jira] [Issue Comment Edited] (WICKET-4064) Guice 3.0 integration does not support JSR-330 @javax.inject.Inject annotations

    [ https://issues.apache.org/jira/browse/WICKET-4064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13107836#comment-13107836 ] 

Lasse Lindgård edited comment on WICKET-4064 at 9/19/11 2:17 PM:
-----------------------------------------------------------------

It is not pretty, but would it not be possible to work around this by using runtime bindings instead of imports:


    private static final Set<String> injectAnnotations = new HashSet<String>(Arrays.asList(new String[] { "com.google.inject.Inject", "javax.inject.Inject" }));

    private boolean isAnnotatedWithInject(Field field) {
        for (Annotation anot : field.getAnnotations()) {
            if (injectAnnotations.contains(anot.annotationType())) {
                return true;
            }
        }
        return false;
    }



or maybe something along the lines of this:
Set<InjectionPoint> ipSet = InjectionPoint.forInstanceMethodsAndFields(clazz);


      was (Author: lassel):
    It is not pretty, but would it not be possible to work around this by using runtime bindings instead of imports:


    private static final Set<String> injectAnnotations = new HashSet<String>(Arrays.asList(new String[] { "com.google.inject.Inject", "javax.inject.Inject" }));

    private boolean isAnnotatedWithInject(Field field) {
        for (Annotation anot : field.getAnnotations()) {
            if (injectAnnotations.contains(anot.annotationType())) {
                return true;
            }
        }
        return false;
    }


  
> Guice 3.0 integration does not support JSR-330 @javax.inject.Inject annotations
> -------------------------------------------------------------------------------
>
>                 Key: WICKET-4064
>                 URL: https://issues.apache.org/jira/browse/WICKET-4064
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket-guice
>    Affects Versions: 1.4.18, 1.5.0
>            Reporter: Lasse Lindgård
>            Priority: Minor
>             Fix For: 1.6.0
>
>
> GuiceComponentInjector only checks for com.google.inject.Inject annotations, but Guice 3.0 also supports the JSR-330 javax.inject.Inject annotation.
> http://code.google.com/p/google-guice/wiki/JSR330
> It would be nice if the wicket integration also supported the standard annotations.
> http://svn.apache.org/viewvc/wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceComponentInjector.java?revision=1062356&view=markup

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira