Is it legal to inject a @Stateful into an MDB?
问题 Is it legal to inject a @Stateful into an MDB? @Stateful public class InteruptBean implements Interrupt { .... } @MessageDriven(...) public class EchoTrigger implements MessageListener { @EJB Interrupt interrupt; .... } Or better phrased: Can I use a stateful EJB to pass state around in an asynchronous Event Driven Architecture? 回答1: Yes, it's "legal", but it's nonsensical. MDBs instances are pooled like SLSBs. The MDB will become non-functional after the SFSB times out. It might work to