<jaxws:client> does not support anonymous bean declaration
----------------------------------------------------------

                 Key: CXF-2454
                 URL: https://issues.apache.org/jira/browse/CXF-2454
             Project: CXF
          Issue Type: Bug
          Components: Configuration, JAX-WS Runtime
    Affects Versions: 2.2.3
         Environment: spring-2.5.*
            Reporter: Stas Garifulin
            Priority: Minor


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.


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