Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2722

@EJB injection in interceptor class and in target class result in injection of instances of two different classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 8.0.0.CR1
    • CDI / Weld
    • None

    Description

      Interceptors spec, 2.2.1 - Interceptor Environment:

      Interceptor class shares the enterprise naming context of its associated target class. (1)

      Assume the following scenario:
      Ear: test-ejb.jar, test1.war, test2.war
      test-ejb.jar: Animal, BarBinding
      test1.war: BarInterceptor, Dog
      test2.war: Bar, Cat

      Short description of the classes:

      @Stateful public class Dog implements Animal {...}
      
      @Stateful public class Cat implements Animal {...}
      
      @BarBinding @Stateless
      public class Bar {
          @EJB
          Animal animal;
      }
      
      @BarBinding @Priority(1000) @Interceptor
      public class BarInterceptor {
          @EJB
          Animal animal;
      }
      

      Bar gets injected an instance of Cat, whereas BarInterceptor gets injected an instance of Dog, which IMHO contradicts (1).

      Test case at: https://github.com/cdi-spec/cdi-tck/pull/38
      (InterceptorEnvironmentJNDITest, InterceptorEnvironmentJNDISessionBeanTest)

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-jharting Jozef Hartinger
              bafco Matus Abaffy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: