“Offline” EJB containers

From time to time you may encounter different situations when you want your enterprise beans (both @EJB and @Inject – aka CDI) to be injected independently from the EJB container. Usually in these situations you have no access to any EJB container at all. Such situations can occur when running integration tests, applications where a piece of functionality has to be available on both (non-enterprise)client and server side and many others (there must be other cases… I can’t really think of any right now, but I am certain they exist). Well in these cases you’ve got to inject your stuff somehow, unless you want to end up with a bunch of NullPointerExceptions. Continue reading ““Offline” EJB containers”