Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Not sure why you're against the solution you proposed. <BR> I was about to offer stuff like <a href="http://www.jboss.org/arquillian.html" rel="nofollow">Arquillian</a>, but hey - you don't want to have a container involved. <BR> I just want to be sure about the reason you don't want container, before I move on to some ideas (though I did not test them) - <BR> With JBoss AS 7.x deployment time of enterprise application servers was vastly reduced, <BR> Not to mention that with Arquillian you have a deployment API, and you can decide what you will deploy (i.e - deploy for example just a single bean for a given test). <BR> However, I do respect you question, so here are some ideas - <BR> A. You mentioned you managed to inject an EntityManager using reflection - how did you do that? <BR> Why not apply the same to your beans? <BR><BR> B. If you're encountering problems with A, why not develop your own injection code , based on <a href="http://cglib.sourceforge.net/" rel="nofollow">cglib</a> , for example (in order to create Proxy not just for interface, but also for classes). <BR> This way, when an object of the class is created, <BR> you will be able to intercept the default CTOR, <BR> and scan for fields annotated with @Ejb. <BR> I would suggest using some sort of configuration file that maps for each bean interface how to instantiate an appropriate class, and run this flow recurisevely (as the injected bean might have a field with @EJB annotation as well). <BR><BR> Pay attention that if you decide to use this method of work, you'll be implementing some sort of "mini dependnecy injection framework" - besides the fact that personally I would be interested in seeing your code ( :) ) I think you should carefully think why you don't want to use an "already made solution.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload