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

@PreDestroy method invoked twice

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.4.Final
    • 1.1.3.SP1
    • Scopes & Contexts
    • None
    • 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

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

      Problem occurs in destroy() method:

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

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

                Created:
                Updated:
                Resolved: