L'injection d'un statique EJB, non?

Je veux écrire ce morceau de code :

@Stateless
public class MyEjb
{
    @EJB
    private static MyOtherEjbWhichIWantStatic myOtherEjb;
}

Il fait sens pour moi, que je veux injecter un EJB dans ma classe, comme un élément statique, pour diverses raisons.

Java n'est pas très heureux avec qui, malheureusement,

com.sun.enterprise.container.common.spi.util.InjectionException: Illegal use of static field private static MyOtherEjbWhichIWantStatic myOtherEjb on class that only supports instance-based injection

Je ne comprends pas, pourquoi je ne peux pas injecter un statique EJB dans un autre EJB ?

InformationsquelleAutor Cyril Gandon | 2010-07-07