EJB: Dependency injection without Interface
问题 I had this code @Local interface IRepo { //... } @Stateless class Repo implements IRepo { // .. } class WebS { @EJB private IRepo repo; // ... } And all worked normally. But now I remove interface IRepo and make @Stateless class Repo { // .. } class WebS { @EJB private Repo repo; // ... } and JNDI look up fails. could not resolve global JNDI name for @EJB for container WebS ... Can I make Dependency injection without Interface? 回答1: You should use @Stateless @LocalBean // <-- annotation here