2012-08-30 43 views
9

我想在啓動時使用啓動ejb做些事情。但我的豆從來沒有被調用過。啓動ejb bean不起作用

這是我的豆:

import javax.annotation.PostConstruct; 
import javax.ejb.Startup; 
import javax.inject.Singleton; 

@Singleton 
@Startup 
public class StartupBean { 

    @PostConstruct 
    public void doSomething(){ 
     System.out.println("why??"); 
    } 

} 

我使用JBoss 7.1.1。

我在做什麼錯了?你可以在bitbucket找到我的源代碼:https://bitbucket.org/cremersstijn/jee/src/9e22ed2b798a/simple-startup-bean

回答