春季码头UriInfo注入为null [英] spring jetty UriInfo inject is null

查看:103
本文介绍了春季码头UriInfo注入为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用春季码头进行休息呼叫.

we are using spring jetty for rest call.

我们正在按如下方式注入上下文

we are injecting context as follows

@Context
private UriInfo uriInfo;

我们已经在许多服务中注入了uri信息.它适用于所有人,但其中一个例外 它被注入为空.

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.

**此外,代理对象是因为我已经在此类方法上应用了AOP.希望这也可以帮助你们帮助我.

**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.

谢谢.

推荐答案

<aop:aspectj-autoproxy proxy-target-class="true"/>

这就是导致问题的原因.

this is what causing the problem this so.

由于使用了Java默认代理,因此我之前使用它.当我将其更改为<aop:aspectj-autoproxy proxy-target-class="true"/>时.该问题似乎已解决.

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.

从经验看来,这是因为Java代理库在转换CGLIB代理库时解决了.

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. :)

这篇关于春季码头UriInfo注入为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆