6 Replies Latest reply on Jan 29, 2010 3:22 AM by Peter Royle

    Bean instantiated twice

    Pieter Martin Novice


      I am using weld in the standalone SE manner.

      At the moment I only have 2 beans.

      public class Entry {
           TestInject testInject;
           public void train(@Observes ContainerInitialized event) {
                System.out.println("NeuralNetworkStart ");

      public class TestInject {
           public TestInject() {
                System.out.println("TestInject constructor");
           public void postContruct() {
           public void preDestroy() {
           public void doStuff() {
                System.out.println("doin stuff u know");

      The TestInject class is instantiated twice. Once before the ContainerInitialized event fires and again before the doStuff method call.

      Further I noticed that the @PostConstruct fires but the @PreDestroy never fires.

      What am I doing wrong?