Getting Stuff from the Container
Generally speaking the only way to get a container controlled resource is via dependency injection or lookup from within a container managed component. This can be configure equally via xml or annotations.
Bean Lookups with InitialContext
- Server side beans should access other beans on the server via the default no args constructor. EJB 3 spec 15.3.1 Bean Provider's Responsibilities
- Security Propagation - see also
- The lookup names must be preceded with "java:comp/env", as in "java:comp/env/myBean".