开发者

EJB module initialization listener

开发者 https://www.devze.com 2023-01-17 06:09 出处:网络
It\'s posible to define a liste开发者_开发技巧ner for EJB 3.0 .jar that is called in the module/context initialization?

It's posible to define a liste开发者_开发技巧ner for EJB 3.0 .jar that is called in the module/context initialization? Similar to the ServerContextListener for web project?


AFAIK, not with EJB 3.0. With EJB 3.1 you can use a Singleton EJB to do so.

From Application Startup / Shutdown Callbacks:

   1:  @Startup
   2:  @Singleton
   3:  public class FooBean {
   4:   
   5:    @PostConstruct 
   6:    void atStartup() { ... }
   7:   
   8:    @PreDestroy
   9:    void atShutdown() { ... }
  10:   
  11:  }

See this answer for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消