Hi

Sorry for a late reply - I've finally managed to do a quick test this
evening and I had no problems with
UriInfo injected into @Context annotated fields.

Can you provide more info please ? How does a (sample) spring context look
like ?
cheers, Sergey


On Tue, Jun 15, 2010 at 8:39 PM, Jason Chaffee <[email protected]> wrote:

> I am trying to inject UriInfo into a field so that I don't have to
> inject it into every method.  This works correctly when I deploy the app
> as a webapp, but when I try to test my services using
> JAXRSServerFactoryBean it doesn't get injected and I get a NPE.
> However, it will get injected if I change service to inject into each
> method.
>
>
>
> Any ideas what might be going wrong here?
>
>
>
> Here is the code snippet:
>
>
>
>        final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>
>        sf.setResourceClasses(MyService.class);
>
>        sf.getInInterceptors().add(new LoggingInInterceptor());
>
>        sf.getOutInterceptors().add(new LoggingOutInterceptor());
>
>
>
>        sf.setResourceProvider(MyService.class,
>
>            new SingletonResourceProvider(ctx.getBean("myService")));
>
>        sf.setAddress(BASE_URI);
>
>
>
>        sf.create();
>
>
>
> and I have the folliwing field in MyService:
>
>
>
> @Context UriInfo uriInfo;
>
>
>
> Jason
>
>

Reply via email to