2 Replies Latest reply on Jan 29, 2015 6:22 PM by Dmitrii Tikhomirov

    init bean on app start

    Dmitrii Tikhomirov Newbie

      Hi, 

      I am interesting in ability to instantiate bean on startup of my app like Errai's @Service annotation do or Ejb's @Startup.

      Thanks !

        • 1. Re: init bean on app start
          Christian Sadilek Master

          Hi Dmitry,

           

          If you can't use @Service or @Startup, an alternative would be to simply use a servlet: @WebServlet(name="startup", loadOnStartup="1"). A servlet context listener would also be an option.

           

          Cheers,

          Christian

          1 of 1 people found this helpful
          • 2. Re: init bean on app start
            Dmitrii Tikhomirov Newbie

            Wow so quick i don't want to use @Startup because of gwt's sdm. I thought that this is a potentially dangerous to use @Service or @webService annotations, so thanks for you answer !

             

            ps:

            some stuff really simple with Spring:

             

            @Component

            public class ActiveMQStarter {

              private static final Logger LOG = LoggerFactory.getLogger(ActiveMQStarter.class);

             

              @PostConstruct

              public void init() {


            }