简体   繁体   中英

How to run a program automatically when just glassfish server is started?

I want my java web application run a program automatically when i start or deploy the program in glassfish server. My web application need to run a mail program inside glassfish when just deployed.

您可以只在数据库中设置一些标志类型属性,然后在运行程序后更改该值。

You can set up a servlet to run on application startup, or possibly use the @Singleton annotation, depending on whether you want EJB involved. Or if you're using Spring, there are more ways. You could give some more background for better answers.

What does the servlet <load-on-startup> value signify

http://java.sun.com/developer/technicalArticles/JavaEE/JavaEE6Overview_Part3.html#singles

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM