2011-10-11 7 views
6

Sto cercando di definire un bean Jaxb2Marshaller in Spring-WS per utilizzare un adattatore personalizzato che estende XmlAdapter. Ho quanto segue in un file XML:Come impostare l'elenco Jaxb2Marshaller di XmlAdapters nel bean Spring tramite XML?

<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> 
    <property name="classesToBeBound"> 
     <list> 
      <!-- various classes to be bound... --> 
     </list> 
    </property> 
    <property name="schema" value="myschema.xsd" /> 
    <property name="adapters"> 
     <list> 
      <value>com.lmig.am.claims.clip.ContactAdapter</value> 
     </list> 
    </property> 
</bean> 

Tuttavia, sto ottenendo il seguente errore:

Cannot convert value of type [java.lang.String] to required type [javax.xml.bind.annotation.adapters.XmlAdapter] for property 'adapters[0]': no matching editors or conversion strategy found

Tutte le idee che sto facendo male? Grazie!

risposta

6

La proprietà adapter si aspetta un array di oggetti XMLAdapter non Classes. Quindi la configurazione corretta è la seguente.

<property name="adapters"> 
    <list> 
     <bean class="com.lmig.am.claims.clip.ContactAdapter"/> 
    </list> 
</property> 
Problemi correlati