dimanche 28 juillet 2013

@EJB vs @Inject ?


Today, I dig into the internet about this question :

Should  I link my EJB Services to DAO / EJB persistance layer with
a) @EJB
OR
b) @Inject / à la CDI ?

THE source : Gavin King himself explains in that thread the detailed answer :

https://community.jboss.org/thread/179388#comment107817

It's amazing how Gavin is clear. Read the post fully : you'll have no doubt about the detailed answer :


@EJB is completely eliminated for local EJBs (except for backward compatibility). There are lots and lots of examples in the CDI spec and Weld documentation of using @Inject to inject local EJBs. And lots of times where I've explained that we strongly recommend the use of @Inject instead of @EJB to inject local EJBs. How could you possibly have missed that? Because you were too busy posting questions and brain-dead criticism instead of actually reading what is already out there?

Considering this excerpt, Gavin is touching the real problem here : I think I should improve the way I'm looking for answers ;)

On your side, I just hope that you didn't waste too much time on this question before finding this link. The noise on Stackoverflow  becomes anoying, hiding the real answers.