I need to execute some code after the start of the application server (JBoss).
I googled the annotations @startup and @create that might prove useful, but in this situation seems impossibile to operate with EntityManager or Hibernate current session (if using Hibernate).
Is there any chance to perform Hibernate operation immediately after JBoss is started?
Are you using a framework? If not, you could use a startup servlet. In your
web.xml, simply mark the servlet to have a<load-on-startup>value and it will run when the webapp is started. If you want it to load after other servlets, just set the load order.If you are using a framework, it will have its own methodologies, such as Spring’s
InitializingBeaninterface.