Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-17811

Incorrect bean injection eligibility assumption for beans excluded using DeltaSpike @Exclude

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • LATER
    • None
    • cdi-extensions
    • None

      With the following classes on the classpath:

      DeactivatableTest.java
      @Inject
      private MyBean myBean;
      
      MyBean.java
      @Exclude
      public class MyBean {}
      
      ExcludeExtensionDeactivator.java
      public class ExcludeExtensionDeactivator implements ClassDeactivator {
          public Boolean isActivated(Class<? extends Deactivatable> targetClass {
              if (ExcludeExtension.class.equals(targetClass)) {
                  return false;
              }
              return null;
          }
      }
      

      ..the injection point in DeactivatableTest is marked with a warning:

      No bean is eligible for injection to the injection point [JSR-299 §5.2.1]	

      ..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.

            jmaury@redhat.com Jeff MAURY
            rsmeral Ron Šmeral (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: