spring jetty UriInfo inject is null

女生的网名这么多〃 提交于 2019-12-13 01:17:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!