0

I'm going to start a Java EE project with EJB3.1 technology. I know the new EJB concept allows Context and Dependency Injection.

In an old project I used GIN and GUICE in a GWT Project. It was nice. Can I use these frameworks also with EJB? Or do you think another framework would be a better choice?

Any Experience?

Kayser
  • 6,544
  • 19
  • 53
  • 86
  • 1
    Don't want to be picky, but Java Enterprise is in version 6 (JEE 6) since 2009, with version 7 (JEE 7) coming out this year. So - thank god - no more J2EE :-) – Jan Groth Apr 05 '12 at 19:51

2 Answers2

0

It's possible as described in this tutorial: Guice Tutorial part 3 – Integrating Guice with EJB

I'd choose Guice over any other DI framework

Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
0

Or do you think another framewirk would be a better choice?

It's impossible to answer that without knowing any requirements. CDI and EJB are defined in the same spec, so you can be absolutely certain that they play well together.

It would also be important to know why you are planning to use EJB 3.1 (certainly not because the name sounds cool) and what features of EJB you want to use.

As a rule of thumb I would keep the core APIs together (EJB & CDI in this case), unless I had a very good reason to start mixing things.

Jan Groth
  • 14,039
  • 5
  • 40
  • 55