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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 3.0.0.Alpha17
    • Events
    • None

      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

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

              Created:
              Updated:
              Resolved: