users@jersey.java.net

[Jersey] Re: Jersey 2.2 Spring Integration issues

From: Daniel Kirkdorffer <dankirkd_at_comcast.net>
Date: Mon, 19 Aug 2013 20:12:54 +0000 (UTC)

That seems messed up to me: if I'm configuring via XML I shouldn't need to use annotations for it to work. At least that's what I thought.

A little testing with that concept seems to indicate that @Inject on the setter is also enough for it to inject my dependency.

I've been testing the same behavior with RESTEasy and it appears that the handling of annotations, and the returning of my singleton instance is working correctly with RESTEasy's integration with Spring - so I know I'm not losing my mind. :^)

Dan



---
Daniel Kirkdorffer
dankirkd_at_comcast.net
----- Original Message -----
From: "Ivar" <ivarconr_at_gmail.com>
To: users_at_jersey.java.net
Sent: Monday, August 19, 2013 12:53:24 PM
Subject: [Jersey] Re: Jersey 2.2 Spring Integration issues


Hi Dan,


I have also been struggling today to get the resources wired up with applicationContext.xml instead of annotations. I manged to achieve this after adding the " @Component" annotation to my resource. This makes jersey-spring3 (SpringComponentProvider.java) to not create a new instance of the resource and instead reuse the one provided by spring.


I have put an example of this on github: https://github.com/ivarconr/jersey2-spring3-webapp




When it comes to your other questions about @Service and @Singleton annotations and new instances I have not got so far in my testing yet. Please respond back with more information if you gain any more knowledge.


Ivar
‚Äč