users@jersey.java.net

Re: [Jersey] injecting UriInfo in constructor

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 04 Feb 2010 10:27:32 +0100

Hi Arul,

Constructor injection of JAX-RS/Jersey artifacts when using Guice, CDI
or Spring is not currently supported. In such cases you need to use
field in conjunction with @PostConstruct or use a setter method.

One hacky way of doing this is to create a component with UriInfo
injected into a field, then inject that component into the
constructor. That component can implement the UriInfo interface and
defer to the injected UriInfo.

Paul.

On Feb 4, 2010, at 12:41 AM, Arul Dhesiaseelan wrote:

> I see from the javadocs that Jersey does not inject UriInfo from a
> constructor. Is there any other way to get access to the URIBuilder
> inside the constructor?
>
> -Arul
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>