0 Replies Latest reply: May 3, 2012 6:08 AM by 934779 RSS

    @Qualifier with array member

    934779
      Hi!

      I want to develop a CDI Qualifier to differentiate between bean implementations at injection points. As long as i use a single enum as member, everythings works fine. But if i change from enum to array of enum, i got an exception on deployment. Can someone explain this to me?

      The qualifier:
      @Qualifier
      @Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
      @Retention(RetentionPolicy.RUNTIME)
      @Documented
      public @interface MultiTenancy {
          Tenant[] value() default { Tenant.COMPANY1 };
      }
      Anotation in use:
      @Stateless
      @Local(InvoiceService.class)
      @MultiTenancy({ Tenant.COMPANY2 })
      public class InvoiceServiceBean implements InvoiceService {
      }
      The Exception:
      org.jboss.weld.exceptions.IllegalArgumentException: WELD-001301 Annotation @MultiTenancy(value=[COMPANY2]) is not a qualifier
          at org.jboss.weld.resolution.ResolvableBuilder.checkQualifier(ResolvableBuilder.java:174)
          at org.jboss.weld.resolution.ResolvableBuilder.addQualifier(ResolvableBuilder.java:145)
          at org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:167)
          at org.jboss.weld.manager.BeanManagerImpl.resolveDecorators(BeanManagerImpl.java:731)
          at org.jboss.weld.bean.AbstractClassBean.initDecorators(AbstractClassBean.java:325)
          at org.jboss.weld.bean.AbstractClassBean.initializeAfterBeanDiscovery(AbstractClassBean.java:313)
          at org.jboss.weld.bean.SessionBean.initializeAfterBeanDiscovery(SessionBean.java:208)
          at org.jboss.weld.bootstrap.BeanDeployment.doAfterBeanDiscovery(BeanDeployment.java:216)
          at org.jboss.weld.bootstrap.BeanDeployment.afterBeanDiscovery(BeanDeployment.java:208)
          at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:352)
          at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82)
          at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
      I am using JBoss 7.1.1 and Java JDK1.6.0_32

      Thanks in advance
      Joachim