如何通过XML在Spring bean中设置Jaxb2Marshaller XmlAdapter列表?

hol*_*c87 6 xml spring spring-ws jaxb jaxb2

我正在尝试Jaxb2Marshaller在Spring-WS中定义一个bean来使用扩展的自定义适配器XmlAdapter.我在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>
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下错误:

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

我有什么想法我做错了吗?谢谢!

gka*_*mal 7

adapters属性期望XMLAdapter对象的数组而不是Classes.所以正确的配置如下.

<property name="adapters">
   <list>
         <bean class="com.lmig.am.claims.clip.ContactAdapter"/>
   </list>
</property>
Run Code Online (Sandbox Code Playgroud)