问题
we are using spring jetty for rest call.
we are injecting context as follows
@Context
private UriInfo uriInfo;
we have inject the uri info in many services. It is working fine for all, except one where it is injected as null.
After analyzing log i found for null injected class the type is printed as proxy object as shown in below
Jan 18, 2013 4:32:07 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, organizationProvisioningImpl, of type $Proxy53 as a root resource class
And for successfully injected class the type is printed as name of class .
Must be the proxy which is the reason why the context is not injected.
The class are defined similarly but dont why this happing.
Any one having same issue or know about the issue please guide me so.
**Adding to above , the proxy object is because i have applied AOP on this class methods. Hope this may also help you guys to help me.
Thanks .
回答1:
<aop:aspectj-autoproxy proxy-target-class="true"/>
this is what causing the problem this so.
Earlier i was using it as due to which java default proxy is used. when i changed it to <aop:aspectj-autoproxy proxy-target-class="true"/>
. The issue seems to resolves.
From experince it seems fight because java proxy library which solved when converted CGLIB proxy lib.
May be some expert will be able to comment more over it. Because i have not read about these libraries.
But in the end the problem resolved. :)
来源:https://stackoverflow.com/questions/14397971/spring-jetty-uriinfo-inject-is-null