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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 3.0.0.Alpha17
    • Events
    • 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

            Unassigned Unassigned
            ljnelson+github@gmail.com Laird Nelson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: