[weld-issues] [JBoss JIRA] (WELD-973) @Specializes is not compatible with seam-config because of a problem in weld's BeanDeployerEnvironment

Geoffrey De Smet (Resolved) (JIRA) jira-events at lists.jboss.org
Thu Nov 24 07:25:41 EST 2011

     [ https://issues.jboss.org/browse/WELD-973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Geoffrey De Smet resolved WELD-973.

    Fix Version/s: 1.1.4.Final
       Resolution: Done

Weld 1.1.4.Final seems to have fixed this issue, tnx :)

Here's what I tested and works:
- @ApplicationScoped RepositoryStartupService is changed with seam-solder-config
- @Alternative @Specializes TestRepositoryStartupService extends RepositoryStartupService is in the classpath too (not activated), but this is not a problem.
- In my tests, TestRepositoryStartupService is activated and RepositoryStartupService doesn't need to be configured by seam-solder-config.
> @Specializes is not compatible with seam-config because of a problem in weld's BeanDeployerEnvironment
> ------------------------------------------------------------------------------------------------------
>                 Key: WELD-973
>                 URL: https://issues.jboss.org/browse/WELD-973
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.1.2.Final
>            Reporter: Geoffrey De Smet
>             Fix For: 1.1.4.Final
> BeanDeployerEnvironment has 2 methods which - combined with seam-config - break @Specializes:
> {code}
> 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;
>       }
>       ...
>    }
> {code}
> 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:
> {code}
> bean = Managed Bean [class org.drools.guvnor.server.repository.RepositoryStartupService] with qualifiers [@Any @Default @Named]
> bean.bean.getWeldAnnotated() = public at Named @XmlConfiguredBean @ApplicationScoped @XmlId class org.drools.guvnor.server.repository.RepositoryStartupService
> {code}
> 2) Later on, getClassBean is called to find the parent class RepositoryStartupService:
> {code}
> clazz = public at Named @ApplicationScoped class org.drools.guvnor.server.repository.RepositoryStartupService
> {code}
> which returns null because the @XmlConfiguredBean bits are missing.
> So I get this exception message:
> {code}
> 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]
> {code}
> 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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the weld-issues mailing list