Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6299

Providers registered in cxf bus are ignored.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.8, 2.7.15
    • 2.7.16
    • JAX-RS
    • None
    • JDK 1.7.0_55

    • Novice

    Description

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

      AbstractJAXRSFactoryBean
      ...
      
          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;
          }
      
      ...
      

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            dstulgis Daumantas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: