users@jersey.java.net

[Jersey] Re: InMemoryTestContainer and injecting dependencies

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 08 Feb 2011 12:20:49 +0100

Hello Jim,

depends on what you are injecting - some objects are not available when
using in-memory container, for example servlet related ones
(ServletContext, HttpServletRequest, ServletConfig, ..) but you should
be able to inject all jersey objects (UriInfo, HttpHeaders, HttpContext,
..).

Pavel

On 02/07/2011 10:31 PM, Jim Webber wrote:
> Hi folks,
>
> Up until now I've just been bringing up my Jersey app atop Jetty for functional testing, but those tests are taking a while to run now (minutes). I'd like to transition to the InMemoryTestContainer instead, on the assumption that'll be much faster.
>
> I do have some dependencies injected into my resource classes (via @Context), how would I go about setting those up if I use the InMemoryTestContainer?
>
> Thanks for your ideas,
>
> Jim
>
>
>