spring jetty UriInfo 注入为空 [英] spring jetty UriInfo inject is null

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

问题描述

我们正在使用 spring jetty 进行休息调用.

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

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

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