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

Ordering of ProcessAnnotatedType events via @Priroty doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.1.1.Final
    • 3.1.0.Final
    • Extensions
    • None

      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?

              manovotn Matěj Novotný
              christian@kaltepoth.de Christian Kaltepoth (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: