cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Benneke (JIRA)" <>
Subject [jira] Updated: (CXF-1645) ResourceInjector fails to inject into (Spring) proxies if resource to be in injected is subclassed
Date Wed, 11 Jun 2008 13:12:45 GMT


Andreas Benneke updated CXF-1645:

    Attachment: ResourceInjector.patch

This patch adds the proposed change to the ResourceInjector and extends the unit test to cover
the specified case .

(Note: the test fails with the unpatched ResourceInjector)

> ResourceInjector fails to inject into (Spring) proxies if resource to be in injected
is subclassed
> --------------------------------------------------------------------------------------------------
>                 Key: CXF-1645
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Andreas Benneke
>         Attachments: ResourceInjector.patch
> If the target is a proxy ResourceInjector tries to resolve an appropriate setter method
for the resource using 
>   Method targetMethod = getTarget().getClass().getMethod(method.getName(), new Class[]{resource.getClass()});
>   targetMethod.invoke(getTarget(), resource);
> This fails if the resource has been subclassed because getMethod() (still) does only
exact matches (see
> This is (for example) the reason why injecting the WebServiceContext into a (Spring)
proxy does not work: The real implementation WebServiceContextImpl is always a subclass (see
> As a solutions, the ResourceInjector might implement it's own matching algorithm or e.
g. use Spring's MethodInvoker instead which already contains such an algorithm:
>   MethodInvoker targetInvoker = new MethodInvoker();
>   targetInvoker.setTargetObject(getTarget());
>   targetInvoker.setTargetMethod(method.getName());
>   targetInvoker.setArguments(new Object[]{resource});
>   targetInvoker.prepare();
>   targetInvoker.invoke();

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message