-
Bug
-
Resolution: Done
-
Major
-
1.1.2.Final
-
None
-
None
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.