问题描述
我正在使用"Jersey Rest",并且希望"Jersey"过滤器可以访问一些春豆.
但是,正如我从其他线程中发现的那样,Jersey无法获得Spring Bean(如果它们是Java代理而不是生成的Java代理).我想添加proxy-target-class ="true"
这样做有什么影响,也可以仅在单个bean上设置它,还是需要在所有引用的bean上设置它?
通过设置proxy-target-class="true"
,您将使用CGLIB2
作为代理,而不是jdk代理.
含义如下,如<文档:
此外,您应该可以使用
为特定组件创建目标代理"proxyMode=ScopedProxyMode.TARGET_CLASS
Im using Jersey Rest and want a Jersey filter to have access to some spring beans.
however as I've discovered from other threads, Jersey does not obtain Spring beans if they are Java proxies as opposed to generated java proxies. I want to add the proxy-target-class="true"
What are the impacts of doing so and also can this just be set on a single bean or does it need to be set on all referenced beans?
By setting proxy-target-class="true"
you will be using CGLIB2
for your proxies, instead of jdk proxys.
The implications are the following, as described in de documentation:
Also, you should be able to make a "target-proxy" for a specific component by using
proxyMode=ScopedProxyMode.TARGET_CLASS
这篇关于使用proxy-target-class ="true"用春豆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!