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

Programmatically added observer methods do not cause containing bean to be instantiated

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Rejected
    • Affects Version/s: 3.0.0.Alpha17
    • Fix Version/s: None
    • Component/s: Events
    • Labels:
      None

      Description

      When a bean is written with an observer method declared like this:

      public void onStartup(@Observes @Initialized(ApplicationScoped.class) final Object payload) {
      
      }
      

      ...the bean is (properly) instantiated per section 5.5.6 of the CDI specification.

      If, instead, an equivalent observer method is programmatically added, the bean is not instantiated.

      The specification does not seem to distinguish between these two cases, so in my opinion the CDI implementation here (Weld) needs to instantiate the bean when invoking a programmatically-added observer method.

      Related forum discussion: https://developer.jboss.org/message/966109

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ljnelson Laird Nelson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: