The following is the requirement:
I have an application which I deploy in the JBoss. There is a method in my application which I want to invoke this method while JBoss starts up.
This method basically does some processing and gathers data which will be used once the server is up.
How can I achieve this functionality in JBoss AS 7??
Option1: EJB 3.1
Create a SLSB with annotations @Singleton and @Startup.
An instance of this bean is instantiated on deployment of your application.
In a method annotated with @Init you can do your things.
Option 2: WebListener
public class StartupTimers implements ServletContextListener
public void contextInitialized( final ServletContextEvent sce )
// do your job here
|Retrieving data ...|