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

<jaxws:client> does not support anonymous bean declaration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.3
    • 2.2.5
    • None
    • spring-2.5.*

    Description

      I would like to declare <jaxws:client> inside a bean property:

      <bean id="myBean" class="...">
      <property name="someService">
      <jaxws:client serviceClass="...SomeServiceInterface" />
      </property>
      <property name="anotherService">
      <jaxws:client serviceClass="...AnotherServiceInterface" />
      </property>
      </bean>

      In this case Spring documentation recommends to keep nested beans anonymous (i.e. no 'id' or 'name' attribute): nested beans cannot be referenced elsewhere so there is no reason to give name. In this case CXF bean definition parsers (like JaxWsProxyFactoryBeanDefinitionParser, ClientProxyFactoryBeanDefinitionParser) work incorrectly. The parsers assume what a name is provided, this cause problem with factory bean names which are constructed by appending factoryIdSuffix to the provided name: if name is not provided all factory beans will use same name ".proxyFactory" (i.e. Spring context will contain only single proxy factory bean of the last initialized anonymous CXF client bean).

      CXF AbstractFactoryBeanDefinitionParser#doParse() method should generate unique IDs if the id is not provided by 'id' or 'name' attribute. Take a look at the org.springframework.beans.factory.xml.BeanDefinitionParserDelegate#parseBeanDefinitionElement(Element ele, BeanDefinition containingBean) which provides an example how unique names can be generated.

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            feerbach Stas Garifulin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: