You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Stas Garifulin (JIRA)" <ji...@apache.org> on 2009/09/30 13:50:32 UTC

[jira] Created: (CXF-2454) does not support anonymous bean declaration

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


[jira] Resolved: (CXF-2454) does not support anonymous bean declaration

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2454.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.5
         Assignee: Daniel Kulp


I've resolved this issue by generating unique id's.

HOWEVER, it's probably also not an issue for 2.2.4.     For 2.2.4, the <jaxws:client> things don't actually use the globally registered .proxyFactory thing for anything.  (they are left there, but marked abstract, for compatibility sake if something is using them for configuration of some sort)      The actual bean definition for the jaxws:client is an instanceof  "FactoryBean" that returns the correct type (so autowire by type works) and as a result, the global .proxyFactory thing is unused.



> <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
>            Assignee: Daniel Kulp
>            Priority: Minor
>             Fix For: 2.2.5
>
>
> 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.