How to load a method on startup in webservice
I have a java webservice using AXIS2 and running on tomcat server.
I need to load a file when the server starts and I 开发者_StackOverflowdo not know how to do it. I have tried adding a main method but it just won't work. Is there any specific stuff that I need to do to load a file when the server starts?
If there's no specific way to do it in the AXIS2 server you could try using a Singleton pattern or a static initialization block.
Don't know much about Axis, but could you either deploy a ContextListener, or a servlet with <load-on-startup>1</load-on-startup>
declared in the web.xml alongside your web service?
精彩评论