users@jersey.java.net

[Jersey] Re: Try to integrete Jersey with Spring but got null pointer when use autowire to inject

From: JNGerbaux <jngerbaux_at_gmail.com>
Date: Fri, 10 Apr 2015 03:04:22 -0700 (MST)

Hello,

if you use "<context:component-scan ....&quot; in your Spring configuration
and want to inject objects in your classes, you have to annote them so
Spring knows about them.
Either add:
- &lt;bean id=&quot;A_NAME_FOR_THAT_BEAN&quot;
class=&quot;CLASS.PACKAGE.YOUR.BEAN&quot; /> in your Spring file
configuration. (No more need of component scan)
Or
- @Service("A_NAME_FOR_THAT_BEAN") as annotation for a service classe,
@Repository("A_NAME_FOR_THAT_BEAN")

Regards,
JN Gerbaux




--
View this message in context: http://jersey.576304.n2.nabble.com/Try-to-integrete-Jersey-with-Spring-but-got-null-pointer-when-use-autowire-to-inject-tp7583189p7583247.html
Sent from the Jersey mailing list archive at Nabble.com.