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

@Specialized bean does not disable second bean: observer method is called

    XMLWordPrintable

Details

    • Hide

      Clone the "Java EE concepts" project and execute.

      Show
      Clone the "Java EE concepts" project and execute.

    Description

      The CDI 1.1 specification says about a @Specialized bean:

      "When an enabled bean, as defined in Section 5.1.2, specializes a second bean, we can be certain that the second bean is never instantiated or called by the container. Even if the second bean defines a producer or observer method, the method will never be called."

      JavaDoc of @Specializes even say that the superclass bean is "disabled".

      However, WELD do call observer methods of the superclass.

      I have a "Java EE concepts" project that execute a series of Java EE tests using Arquillian and the test that test the behavior of @Specializes and supposedly disabled observer methods fail.

      The project is Maven based and has two profiles for WildFly- and GlassFish remote servers. Feel free to clone and execute.

      Read more on this error in the JavaDoc of the test class:

      https://github.com/MartinanderssonDotcom/java-ee-concepts/blob/master/src/test/java/com/martinandersson/javaee/cdi/specializes/SpecializesTest.java

      Attachments

        Activity

          People

            Unassigned Unassigned
            martin.andersson_jira Martin Andersson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: