AFAIK, not with EJB 3.0. With EJB 3.1, you can use EJB Singleton for this.
From Application Launch / Completion Statement :
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 .
source
share