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

@Specializes not resolving @Named

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 1.1.33.Final
    • None
    • None

      When i have the situation above:

      @Alternative
      @Stereotype
      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.TYPE)
      public @interface ETC {}

      public abstract class BpmExpressionService {
      public final static String NAME = "bpmExpressionService";
      }

      @Stateless
      @Named(BpmExpressionService.NAME)
      public class EppBpmExpressionService extends BpmExpressionService {}

      @ETC
      @Stateless
      @Named(BpmExpressionService.NAME)
      public class EtcBpmExpressionService extends EppBpmExpressionService {}

      @Stateless
      @Specializes
      public class EtcmpaBpmExpressionService extends EtcBpmExpressionService {}

      beans.xml file:

      <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">

      <alternatives>
      <stereotype>

      {package}

      .ETC</stereotype>
      </alternatives>
      </beans>

      Following validation error occurs:

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name bpmExpressionService resolves to beans [Session bean [class br.com.infox.bpm.cdi.qualifier.EtcmpaBpmExpressionService with qualifiers [@Default @Any @Named]; local interfaces are [EtcmpaBpmExpressionService], Session bean [class br.com.infox.ibpm.event.EppBpmExpressionService with qualifiers [@Default @Any @Named]; local interfaces are [EppBpmExpressionService]]

      But CDI specification says :

      "When an enabled bean specializes another bean, the other bean is never instantiated or called by the container. Even if the other bean defines a producer or observer method, the method will never be called."

      "Furthermore, if the default implementation declares a bean EL name using @Named, the name is inherited by the specializing alternative bean."

      I changed JBossEAP weld version from 1.1.17 (redhat) to 1.1.33 and the error persist.

      What a could analyze the container is not undestanding EppBpmExpressionService is specialized by EtcmpaBpmExpressionService.

              Unassigned Unassigned
              victorpasqualino@yahoo.com.br Victor Pasqualino (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: