1 Reply Latest reply on Mar 15, 2012 6:10 AM by ktfan

    How to instantiate a user defined class during JBOSS startup

    ktfan

      How can I instantiate a user defined class during JBOSS startup ?

       

      I deploy the user defined class within the jar file.

        • 1. Re: How to instantiate a user defined class during JBOSS startup
          ktfan

          I found that I can use EJB startup bean to do this.

           

          @Singleton

          @Startup

          public class StartUpClass{

           

                    static{System.out.println("StartUpClass............");}

           

                    public StartUpClass()

                    {

                              System.out.println("starting startup class...");

                    }

           

           

                    @PostConstruct

                    private void startup()

                    {

                              System.out.println("startup...");

                    }

           

           

                    @PreDestroy

                    private void shutdown()

                    {

                              System.out.println("shutdown...");

                    }

          }