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

Injection does not occur into a normal scoped observer bean if @Observes method is private

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 1.0.1.Final
    • Events
    • None
    • Workaround Exists
    • Hide

      Change the access of the observer method to public, protected or package.

      Show
      Change the access of the observer method to public, protected or package.

    Description

      If the observer method of a bean is private, and the bean which contains it has a scope (it's proxied), then injection into the bean does not occur.

      For example, the injection points are null when the following observer is invoked:

      @SessionScoped
      public class SampleObserver implements Serializable {
      @Inject SampleHelper helper;

      private void observes(@Observes final SampleBean bean)

      { System.out.println("Did injection occur? " + (helper = null ? "no" : "yes")); }

      }

      Prints:
      Did injection occur? no

      Attachments

        Issue Links

          Activity

            People

              pmuiratbleepbleep Pete Muir (Inactive)
              dan.j.allen Dan Allen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: