java ee - How to Execute a Class when server is Starting -
this question has answer here:
i have dynamic webproject created in eclipse glassfish server, want execute specific class automatically when server started. class has listener listens jms queue, how can achieve this? have configure in web.xml? if how it? code example appreciated.
there alot of ways achieve this. can make startup ejb singleton. this:
@singleton @startup public class mystartupbean { @postconstruct private void init() { log.info("initializing startup bean"); // stuff } }
Comments
Post a Comment