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

@PreDestroy method invoked twice

    XMLWordPrintable

Details

    • Hide

      for(Bean b: bm.getBeans(TestBean.class)){
      CreationalContext ctx = bm.createCreationalContext(null);
      TestBean testBean = (TestBean)bm.getReference(b, b.getBeanClass(), ctx);
      b.destroy(testBean, ctx);
      }

      TestBean is simple POJO with @PreDestroy method

      Show
      for(Bean b: bm.getBeans(TestBean.class)){ CreationalContext ctx = bm.createCreationalContext(null); TestBean testBean = (TestBean)bm.getReference(b, b.getBeanClass(), ctx); b.destroy(testBean, ctx); } TestBean is simple POJO with @PreDestroy method

    Description

      @PreDestroy method on @Dependend scope is invoked twice when we use Bean.destroy() method.

      Problem occurs in destroy() method:

      getInjectionTarget().preDestroy(instance);
      creationalContext.release();

      Attachments

        Activity

          People

            ajustin@redhat.com Ales Justin
            wojtek9_jira wojtek k (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: