You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2015/03/13 15:07:39 UTC

[jira] [Commented] (CXF-6299) Providers registered in cxf bus are ignored.

    [ https://issues.apache.org/jira/browse/CXF-6299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14360384#comment-14360384 ] 

Sergey Beryozkin commented on CXF-6299:
---------------------------------------

ProviderFactory checks it internally, I have a test (or two) for that.
See
https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java;h=b9ecbd43b31dfbef7f00377134aa97114600a6e7;hb=4b006fecc58c917b4804bba270f798bef8361ada#l707

Can you debug that code or provide a test case ? 
Sergey

> Providers registered in cxf bus are ignored.
> --------------------------------------------
>
>                 Key: CXF-6299
>                 URL: https://issues.apache.org/jira/browse/CXF-6299
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.8, 2.7.15
>         Environment: JDK 1.7.0_55
>            Reporter: Daumantas
>
> Providers list configured following http://cxf.apache.org/docs/jaxrs-services-configuration.html documentation.
> Bus object created with configuration and is being set to ProviderFactory, but configured providers from bus are never used by ProviderFactory.
> To fix problem following example can be used (updated existing initialization method):
> {code:title=AbstractJAXRSFactoryBean|language=java}
> ...
>     private static final Object BUS_PROVIDERS_ALL = "org.apache.cxf.jaxrs.bus.providers";
> ...
>     protected ProviderFactory setupFactory(Endpoint ep) { 
>         ProviderFactory factory = ProviderFactory.createInstance(getBus()); 
>         if (entityProviders != null) {
>             Map<String, Object> busProperties = getBus().getProperties();
>             List<?> busProviders = (List<?>)busProperties.get(BUS_PROVIDERS_ALL);
>             if (busProviders != null) {
>                 entityProviders.addAll(busProviders);
>             }
>             factory.setUserProviders(entityProviders);
>         }
>         setDataBindingProvider(factory, ep.getService());
>         
>         factory.setBus(getBus());
>         factory.initProviders(serviceFactory.getRealClassResourceInfo());
>         if (schemaLocations != null) {
>             factory.setSchemaLocations(schemaLocations);
>         }
>         
>         setBeanInfo(factory);
>         
>         ep.put(ProviderFactory.class.getName(), factory);
>         getBus().setProperty(ProviderFactory.class.getName(), factory);
>         return factory;
>     }
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)