I have learned that xml deployment descriptors override annotations.
So I am trying to use that feature to inject a mock implemantion into an EJB for testing:
I am using OpenEJB 3.1.2.
The CreditCardServiceBean gets injected into the TravelAgentBean
I try to override this in the ejb-jar.xml:
however testing the whole setup I see that still the CreditCardServiceBean
Only when I remove the @EJB(beanName="CreditCardServiceBean") annotation the CreditCardServiceMock is injected.
I don't think thats the expected behavior.
Is something wrong with my deployment desprictor?
Any help would be appreciated.
A nice override/debug option is to set 'openejb.descriptors.output' to 'true'. With that on the effective runtime descriptor is saved to the temp directory. Then you can take a look to see what your xml and annotations look like combined into the final "one true" descriptor.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: OpenEJB, DI Overriding annotation with deployment descriptor