Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1145

Unsatisfied dependencies for generic type arrays

    Details

      Description

      The following set of beans fail to deploy with

      public class Bar<X>
      {
         public Bar(X x) {
            this.x = x;
         }
         
         public X x;
      }
      
      public class BarsProducer
      {  
         private static Bar<Integer>[] bars = new Bar[]{new Bar<Integer>(new Integer(1))};
         
         @Produces
         public Bar<Integer>[] getBars() {
            return bars;
         }
      }
      
      public class Foo
      {
         @Inject Bar<Integer>[] field;
      }
      
      14:23:47,915 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."jboss-as-helloworld.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss-as-helloworld.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Bar[]] with qualifiers [@Default] at injection point [[field] @Inject org.jboss.as.quickstarts.helloworld.Foo.field]
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Bar[]] with qualifiers [@Default] at injection point [[field] @Inject org.jboss.as.quickstarts.helloworld.Foo.field]
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
              at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
              at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
              at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
              at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
              at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:380)
              at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
              at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
              ... 5 more
      

      Also note that the src/test/java/org/jboss/weld/tests/arrays/ArrayInjectionTest.java will fail if @Inject is used to inject the arrays instead of the arquillian enrichment.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  luksa Marko Luksa
                  Reporter:
                  maschmid Marek Schmidt
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: