The advantage of using JAX-RS 2.0 with CDI / Weld instead of Guice?

One of the goals of JAX-RS 2.0 was to integrate CDI and replace the old @Contextwith a common injection @Inject. But if I look at JSR 339 , this is not mentioned. So what exactly is CDI integration? Will there be any advantage to using JAX-RS with CDI instead of Google Guice?

+5
source share
1 answer

@Contextis still the official injection method in JAX-RS 2.0. However, the specification states that the implementation MAY use @Injectalong with @Context(from section 10.2.5 JAX-RS 2.0 EDR 3):

@Inject @Resource JAX-RS. , -.

, JAX-RS 2.0 @Inject, , JAX-RS 2.0.

, , 2.0 @Inject.

, @Inject @Context , @Inject JAX-RS, - JAX-RS.

+4

All Articles