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

@Specializes is not compatible with seam-config because of a problem in weld's BeanDeployerEnvironment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.1.4.Final
    • 1.1.2.Final
    • None
    • None

    Description

      BeanDeployerEnvironment has 2 methods which - combined with seam-config - break @Specializes:

      public class BeanDeployerEnvironment {
      
         private final Map<WeldClass<?>, AbstractClassBean<?>> classBeanMap;
      
         protected void addAbstractClassBean(AbstractClassBean<?> bean)
         {
            ...
               classBeanMap.put(bean.getWeldAnnotated(), bean);
            ...
         }
      
         public AbstractClassBean<?> getClassBean(WeldClass<?> clazz)
         {
            if (!classBeanMap.containsKey(clazz))
            {
               return null;
            }
            ...
         }
      
      

      Here's what happens:
      In this use case I have a bean RepositoryStartupService, which is extra configured by seam-config.
      It is also specialized by TestRepositoryStartupService (for tests).

      1) First addAbstractClassBean is called with these parameters:

      bean = Managed Bean [class org.drools.guvnor.server.repository.RepositoryStartupService] with qualifiers [@Any @Default @Named]
      bean.bean.getWeldAnnotated() = public@Named @XmlConfiguredBean @ApplicationScoped @XmlId class org.drools.guvnor.server.repository.RepositoryStartupService
      

      2) Later on, getClassBean is called to find the parent class RepositoryStartupService:

      clazz = public@Named @ApplicationScoped class org.drools.guvnor.server.repository.RepositoryStartupService
      

      which returns null because the @XmlConfiguredBean bits are missing.

      So I get this exception message:

      org.jboss.weld.exceptions.DefinitionException: WELD-000047 Specializing bean must extend another bean:  Managed Bean [class org.drools.guvnor.server.repository.TestRepositoryStartupService] with qualifiers [@Any @Default]
      

      One can argue that since seam-config is not configuring TestRepositoryStartupService a failure is normal,
      but even in that case the exception message is very misleading, as looking at the code TestRepositoryStartupService clearly extends RepositoryStartupService which is also a bean.

      Attachments

        Issue Links

          Activity

            People

              ajustin@redhat.com Ales Justin
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: