Passer des paramètres au Printemps MethodInvokingFactoryBean arguments de la liste

Je suis en train d'essayer de trouver le moyen de passer des objets à Spring MethodInvokingFactoryBean arguments de la liste. Voici mon Spring configuration:

<bean id="qName" class="javax.xml.namespace.QName">
    <constructor-arg index="0" value="${com.groupgti.esb.online.tests.talentq.tns}"/>
    <constructor-arg index="1" value="${com.groupgti.esb.online.tests.talentq.serviceName}"/>
</bean>

<bean id="wsdlUrl" class="java.net.URL">
    <constructor-arg index="0" value="${com.groupgti.esb.online.tests.talentq.url}"/>
</bean>

<bean id="service" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject">
        <bean id="serviceObject" class="com.groupgti.onlinetest.talentq.jaxb.TQIntegrationV2"/>
    </property>
    <property name="targetMethod">
        <value>create</value>
    </property>
    <property name="arguments">
        <list>
            <value type="java.net.URL">wsdlUrl</value>
            <value type="javax.xml.namespace.QName">qName</value>
        </list>
    </property>
</bean>

Ce n'est pas de travail:

<value type="java.net.URL">wsdlUrl</value>
<value type="javax.xml.namespace.QName">qName</value>

Je suis l'exception:

Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.net.URL'; nested exception is java.lang.IllegalArgumentException: Could not retrieve URL for OSGi resource[wsdlUrl|bnd.id=573|bnd.sym=com.groupgti.esb.online.tests.talentq]: OSGi resource[wsdlUrl|bnd.id=573|bnd.sym=com.groupgti.esb.online.tests.talentq] cannot be resolved to URL because it does not exist

C'est parce que le paramètre est passé comme String, juste wsdlUrl et non pas comme un java.net.URL objet.

J'ai aussi essayé ceci:

<property name="arguments">
    <ref bean="wsdlUrl"/>
    <ref bean="qName"/>
</property>

Cela me donne une exception qui ref attribut n'a pas sa place ici. Alors alors, comment devrais-je passer un objet à la liste des arguments?

OriginalL'auteur Paulius Matulionis | 2012-09-07