如何通过XML在Spring bean中设置XmlAdapters的Jaxb2Marshaller列表?
我试图在 Spring-WS 中定义一个 Jaxb2Marshaller 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>
但是,我收到以下错误:
Cannot conversion value of type [java.lang.String] to required type [javax.xml.bind.annotation.adapters.XmlAdapter]对于属性“适配器[0]”:找不到匹配的编辑器或转换策略
知道
我做错了什么吗?谢谢!
I'm trying to define a Jaxb2Marshaller
bean in Spring-WS to use a custom adapter that extends XmlAdapter
. I have the following in an XML file:
<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>
However, I'm getting the following error:
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
Any ideas what I'm doing wrong? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
适配器属性需要 XMLAdapter 对象的数组而不是类。所以正确的配置如下。
The adapters property is expecting an array of XMLAdapter objects not Classes. So the correct configuration is as follows.