Java EE 5 dependency injection?
问题 Since Java EE 5 does not have CDI, how does DI work in here? Can an EJB be injected with @EJB in a class that is a non-EJB? Can an EntityManager be injected with @PersistenceContext in a class that is a non-EJB (container managed not resource local EntityManager )? Or the only solution to bring the resources in non-EJB classes is by JNDI lookup? By non-EJB class I mean a class that is not annotated with @Stateless / @Statefull or others. 回答1: Taken from: http://www.oracle.com/technetwork