I'm working on a Java EE 6 application. When I started out, I was writing tests for my EJB classes by manually instantiating the EJB, then manually adding the members that normally get provided by dependency injection. As the application gets more complicated, I find that this approach just doesn't cut it. So I'd like to be able to start my own EJB container in the test framework, so it can manage my beans. What's the best way to approach this? I've heard of javax.ejb.embeddable.EJBContainer
, are there other options?
(I'm using Glassfish 3, and building with Maven, if that makes any difference.)