[jbosstools-issues] [JBoss JIRA] (JBIDE-17811) Incorrect bean injection eligibility assumption for beans excluded using DeltaSpike @Exclude

Ron Šmeral (JIRA) issues at jboss.org
Mon Jul 7 12:58:24 EDT 2014


Ron Šmeral created JBIDE-17811:
----------------------------------

             Summary: Incorrect bean injection eligibility assumption for beans excluded using DeltaSpike @Exclude
                 Key: JBIDE-17811
                 URL: https://issues.jboss.org/browse/JBIDE-17811
             Project: Tools (JBoss Tools)
          Issue Type: Bug
          Components: cdi-extensions
         Environment: JBDS 8.0.0.Beta2d
            Reporter: Ron Šmeral


With the following classes on the classpath:

{code:java|title=DeactivatableTest.java}
@Inject
private MyBean myBean;
{code}

{code:java|title=MyBean.java}
@Exclude
public class MyBean {}
{code}

{code:java|title=ExcludeExtensionDeactivator.java}
public class ExcludeExtensionDeactivator implements ClassDeactivator {
    public Boolean isActivated(Class<? extends Deactivatable> targetClass {
        if (ExcludeExtension.class.equals(targetClass)) {
            return false;
        }
        return null;
    }
}
{code}

..the injection point in DeactivatableTest is marked with a warning:
{noformat}
No bean is eligible for injection to the injection point [JSR-299 §5.2.1]	{noformat}

..which is incorrect. MyBean *is* eligible despite being annotated @Exclude, since ExcludeExtension is deactivated using the core DeltaSpike mechanism of deactivation (ClassDeactivator).

There does not seem to be a (simple) solution to this other than executing the code in all available ClassDeactivators.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)



More information about the jbosstools-issues mailing list