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

Move bus wiring out of Spring XML handlers

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.1, 2.0.7
    • Component/s: Configuration
    • Labels:
      None

      Description

      Several classes in CXF, such as JaxWs

      {Proxy,Server}

      FactoryBean, EndpointImpl, etc. that take a reference to a Bus automatically wire in a reference to the Spring bean "cxf" if no bus has been explicitly specified. However, this wiring is currently handled in the custom XML handlers, so happens at XML parsing time. This means it is sensitive to the order in which the Spring beans have been defined - the "cxf" Bus bean is only wired in if its definition exists in the Spring context at the time the custom XML is parsed.

      This patch implements an alternative behaviour where we first parse all the bean definitions, then go back and check for the existence of the "cxf" bean and wire it in if necessary. This would mean that the CXF <import>s could go anywhere in your Spring config file (even after your <jaxws:endpoint>s), or even in a separate file. At present, if you put the imports in a separate file you must arrange for this file to be loaded before your others, but this isn't always possible to guarantee.

      Summary of the patch:

      • Anywhere where a Spring XML handler currently does a check for the existence of a bean called "cxf" and wires it into the new definition, replace this code with code to add a custom attribute to the new bean definition instead.
      • BusWiringBeanFactoryPostProcessor, registered by default in cxf.xml, checks bean definitions for this custom attribute and does the wiring.

        Attachments

        1. BusWiringByPostProcessor.diff
          18 kB
          Ian Roberts

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              button_boxer Ian Roberts
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: