Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1764

Constructors should not be intercepted when a binding at class level is declared

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 2.2.5.Final
    • None

    Description

      Given the following bean:

      @Binding
      public class Bean {
          public void method() {}
      }
      

      And the following interceptor:

      @Binding
      @Interceptor
      class Interceptor {
      
          @AroundConstruct
          Object constructor(InvocationContext context) throws Exception {
              return context.proceed();
          }
      
          @AroundInvoke
          Object method(InvocationContext context) throws Exception {
              return context.proceed();
          }
      }
      

      It happens that the @AroundConstruct callback is called.

      From the interceptor specification:

      interceptor at the class level applies to all business methods of the class

      While the notion of business methods may be subject to interpretation, it is reasonable to consider that constructors are not business methods and as a consequence the @AroundConstruct callback should not be called.

      Attachments

        Activity

          People

            Unassigned Unassigned
            astefanu@redhat.com Antonin Stefanutti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: