users@jersey.java.net

Re: [Jersey] Jersey and Spring

From: Lars Tackmann <lars_at_randompage.org>
Date: Mon, 7 Jul 2008 12:11:36 +0200

On Mon, Jul 7, 2008 at 10:24 AM, Martin Grotzke
<martin.grotzke_at_freiheit.com> wrote:
> Hi Lars,
>
> I would say that your UsersResource is not set up correctly: I'd say
> that it is not create by spring and therefore the UserManager should not
> be injected. That you receive status 200 all the time sounds really
> weird to me!
>
> But let's first check if your UsersResource is set up as expected.
> Can you please check, if the UserManager is already injected? If not,
> you should add @Component to your UsersResource, so that spring is aware
> of this class.

HI and thanks for the feedback.

Some real bad code from my part, made the code swollow a null pointer
exception (why this results in 200 is still a mystery though).
it turned out that I had to annotate the resource with;

--
@PerRequest
@Component
@Scope( "prototype" )
--
I can understand the component part, but having to use springs @Scope
annotation is overkill (at least when one also uses Jersey's lifecycle
annotations).
Anyway thanks for the help. I suspect I will have a complete mavenised
Spring/Jersey sample ready in a couple of days (integrated with Spring
security 2) - I will gladly post it here, so others can benefit from
it (perhaps it can go into jersey's example folder).
-- 
Yours sincerely
Lars Tackmann