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

        Bill Shannon created issue -
        Bill Shannon made changes -
        Field Original Value New Value
        Affects Version/s V3 [ 10981 ]
        Hong Zhang made changes -
        Fix Version/s 3.2 [ 10969 ]
        Tags 3_1-exclude
        Cheng Fang made changes -
        Component/s cdi [ 10637 ]
        Hong Zhang made changes -
        Assignee Hong Zhang [ hzhang_jn ] Sivakumar Thyagarajan [ sivakumart ]
        Component/s deployment [ 10594 ]
        Jill Sato made changes -
        Fix Version/s 4.0 [ 10970 ]
        Fix Version/s 3.2 [ 10969 ]
        jjsnyder83 made changes -
        Tags 3_1-exclude 3_1-exclude req-weld-fix
        jjsnyder83 made changes -
        Assignee Sivakumar Thyagarajan [ sivakumart ] jjsnyder83 [ jjsnyder83 ]
        phil.zampino made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: