glassfish
  1. glassfish
  2. GLASSFISH-15148

PostConstruct methods not handled properly for managed beans

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: V3
    • Fix Version/s: 4.0
    • Component/s: cdi
    • Labels:
      None

      Description

      In general, handling of PostConstruct methods for managed beans isn't properly taking into
      account method overriding. This works for EJBs, but the implementation needs to be generalized
      to handle managed beans as well.

      Here's a case that fails:

      @ManagedBean
      public class MBBean extends MBBase {
      @PostConstruct
      public void postConstruct() {
      }
      }

      public class MBBase {
      @PostConstruct
      public void postConstruct() {
      }
      }

      The postConstruct method will be called twice.

      Similarly, if a method hides a PostConstruct method in a superclass,
      the method will still be called.

      The same issues probably apply to preDestroy methods.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            jjsnyder83
            Reporter:
            Bill Shannon
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: