[weld-dev] Why does org.jboss.weld.test.core.TestCore only support qualified injection?

Johan Eltes johan.eltes at callistaenterprise.se
Sun Dec 27 08:32:35 EST 2009


Thanks, works like charm!

/Johan

On 27 dec 2009 v52, at 14.18, Aslak Knutsen wrote:

> I just commited some code that change the injection done in TestCore to use Non-Contextual-Injection. This should fix the issues your having.
> 
> https://jira.jboss.org/jira/browse/WELDX-63
> 
> Do remember that Weld-Test will be 'replaced' by Arquillian, so don't put to much work into it.. :)
> 
> -aslak-
> 
> 2009/12/27 Johan Eltes <johan.eltes at callistaenterprise.se>
> org.jboss.weld.test.core.TestCore is used by the org.jboss.weld.test.junit.CDIRunner to inject the dependencies of the test case. However, it only supports injection of qualified fields. As a side effect, dependencies declared as concrete classes can not be injected, since qualifiers only make sense to interface/abstract dependency declarations:
> 
> package org.jboss.weld.test.core;
> ...
> 
> public class TestCore {
> ...
>  private void injectField(Field field, Object target) throws Exception
>    {
>       if (!hasBindTypeAnnotation(field.getAnnotations()))
>       {
>          return;
>       }
>       if (!field.isAccessible())
>       {
>          field.setAccessible(true);
>       }
>       Object injectable = getInstanceByType(field.getType(), field
>             .getAnnotations());
> 
>       if (injectable != null)
>       {
>          field.set(target, injectable);
>       }
>    }
> 
> Just wondering the value of this restriction?
> 
> /Johan
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
> 
> 
> 
> -- 
> --
> Aslak Knutsen; +47 952 38 791; fax +47 22 33 60 24
> Kongens gate 14; Boks 805 Sentrum, 0104 Oslo;
> http://www.conduct.no; mailto:aslak at conduct.no
> 
> Conduct AS - Professional Open Source Services
> - Red Hat/JBoss Premier System Integrator
> - Pentaho Preferred Integration Partner
> - Atlassian Technology Partner

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20091227/dbb0b856/attachment.html 


More information about the weld-dev mailing list