Hi Jeff
On 03/04/12 00:43, Jeff Wang wrote:
I'm running CXF 2.5.2 with Spring 3.1.1
I declare my beans via
@Service
public class FooImpl implements IFooService {
}
inside FooImpl, @Autowired fields work just fine. However, @Context
UriInfo gave me a IllegalArgumentException for trying to set a $Proxy
to a UriInfo. I then added a<aop:aspectj-autoproxy
proxy-target-class="true"/> to my spring file. This worked (I think)
but a @Context mc gave a null pointer exception when I try to access
it. adding setters and moving the @Context annotation to the setters
did not help. heck,
@Context
public void setMc(org.apache.cxf.jaxrs.ext.MessageContext mc) {
System.out.println("***mc is set");
this.mc = mc;
}
did not result in the println being executed.
the part after 'set' in the method name must match the name of the
context class, example,
setMessageContext
setUriInfo
etc
If the injection is still not working then it is only due to a fairly
complex proxification involved so introducing a dedicated utility
interface such as
public interface Contexts {
@Context
void setMessageContext(MessageContext mc);
}
and having FooImpl implementing it should help
Cheers, Sergey
Finally, when I put the @Context MessageContext mc as a method
parameter, the injection works fine. Am I doing anything that's
unexpected with regard to MessageContext?
thanks
Jeff
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com