2010-09-24 27 views

Répondre

7

AFAIK, pas avec EJB 3.0. Avec EJB 3.1, vous pouvez utiliser un EJB Singleton pour le faire.

De 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: } 

Voir this answer pour plus de détails.