What injection mechanism should I use in Java EE 6?

Java EE 6 offers (at least) two dependency injection mechanisms: DI annotations from Java EE 5, such as @EJB, @PersistenceContext, @Resource ... and the new JSR 330. Can I replace the "old" DI annotations with more general JSR 330 annotations?

Are there any advantages or disadvantages of this or that approach? Which one would you use and why?

+3
source share
2 answers

Go to the JSR 330 annotations. They will work with other DI environments that are being updated, such as Spring 3.0.

+3
source

, JSR330 . , JSR-330 , .

, beans, guice spring . spring beans , , , spring , JSR-330.

+3

Source: https://habr.com/ru/post/1726798/


All Articles