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

Ordering of ProcessAnnotatedType events via @Priroty doesn't work

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.1.0.Final
    • Fix Version/s: 3.1.1.Final
    • Component/s: Extensions
    • Labels:
      None
    • Environment:

      Wildfly 16.0.0.Beta1 with Weld 3.1.0.Final

      Description

      I'm seeing some weird behavior regarding ProcessAnnotatedType events in Wildfly 15 and 16 Beta1.

      I'm deploying an CDI extension contained in a JAR placed in WEB-INF/lib that observers PAT events like this:

      public <T> void processAnnotatedType(
          @Observes 
          @Priority(Interceptor.Priority.PLATFORM_AFTER)
          @WithAnnotations({Controller.class}) 
          ProcessAnnotatedType<T> pat) {
        ...
      }
      

      A CDI extension in HibernateValidator also observers PAT events:

      public <T> void processAnnotatedType(
          @Observes
          @WithAnnotations({Constraint.class, Valid.class, ValidateOnExecution.class}) 
          ProcessAnnotatedType<T> processAnnotatedTypeEvent) {
        ...
      }
      

      Accoding to my understanding of the spec my extension should fire AFTER the Hibernate Validator extension, because of the use of @Priority for ordering.

      Unfortunately this doesn't seem to work correctly. For some reason the observers are notified in random order. So it changes randomly between deployments. Sometimes my extension gets the AnnotatedType which was already modified by the Hibernate Validator extension executed before and sometimes I'm getting an unmodified AnnotatedType and HibernateValidator executed AFTER my extension.

      I'm not 100% sure about that, but AFAIK this worked correctly in previous Wildfly versions (11 or 12?).

      Any idea what is causing this?

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                manovotn Matěj Novotný
                Reporter:
                chkal Christian Kaltepoth
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: