Running thread or other stuff on server (tomcat) startup before any access

Is there any easy way to run thread before anyone inits UI and access it from the future UI instances?

In my case I want to run singleton thread for all the UIs to access but for now it means that some UI have to init it. Is this the right way to do it or is there another way?


You can do such stuff in the servletInitialized() method in the servlet class, as
described in the book