[ 
https://issues.apache.org/activemq/browse/CAMEL-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63195#action_63195
 ] 

Sergey Zolotaryov commented on CAMEL-3117:
------------------------------------------

To fix this I have to override a method in CxfRsEndpoint and do an ugly thing 
like this:

{code}
    @Override
    protected void setupJAXRSServerFactoryBean(final JAXRSServerFactoryBean sfb)
    {
        super.setupJAXRSServerFactoryBean(sfb);
        final CamelContext context = getCamelContext();
        if (context instanceof SpringCamelContext)
        {
            final SpringCamelContext camelContext = (SpringCamelContext) 
context;
            final ApplicationContext applicationContext = 
camelContext.getApplicationContext();
            final Map<String, Object> springProviders = 
applicationContext.getBeansWithAnnotation(Provider.class);

            final List< ? > existingProviders = sfb.getProviders();
            final ArrayList<Object> newProviders = new 
ArrayList<Object>(springProviders.values());
            if (existingProviders != null)
            {
                newProviders.addAll(existingProviders);
            }
            sfb.setProviders(newProviders);
        }
    }

{code}

> cxfbean and cxfrs components should honour jax-rs providers in the bean 
> registry
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-3117
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3117
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 2.4.0
>         Environment: cxfrs and cxfbean
>            Reporter: Christopher Hunt
>            Assignee: Willem Jiang
>             Fix For: 2.5.0
>
>         Attachments: providers.diff
>
>
> The cxfbean component does not presently provide a means of using custom 
> providers i.e. those customised JAX-RS classes that are annotated with the 
> @Provider declaration. 
> My recommendation is that objects instantiated in the bean container from 
> classes annotated with @Provider are automatically registered for use by the 
> cxfrs and cxfbean components. This includes message body writers/readers and 
> parameter handlers i.e. anything that can be presently expressed in the 
> cxf:rsServer/providers element.

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

Reply via email to