XML配置中MarshallingMessageConverter中的java设置MarshallTo获取无效属性“MarshallTo”
我正在尝试创建MarshallingMessageConverter,以下是我的XML:
<bean id="marshallingMessageConverter" class="org.springframework.jms.support.converter.MarshallingMessageConverter">
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
<property name="marshalTo" value="MARSHAL_TO_TEXT_MESSAGE" />
</bean>
我得到以下错误:
Error setting property values; nested exception is
org.springframework.beans.NotWritablePropertyException:
Invalid property 'marshalTo' of bean class
[org.springframework.jms.support.converter.MarshallingMessageConverter]:
Bean property 'marshalTo' is not writable or has an invalid setter method.
Does the parameter type of the setter match the return type of the getter?
这是因为MarshallingMessageConverter没有getMarshallTo方法,因此以这种方式设置它不起作用吗
看起来这应该是可能的,因为我发现https://jira.spring.io/browse/SWS-614,其他人说他们有以下配置工作:
<bean id="marshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"/>
<bean id="xstream" class="org.springframework.oxm.support.MarshallingMessageConverter"
p:marshaller-ref="marshaller" p:unmarshaller-ref="marshaller" p:marshalTo="2"/>
<!--marshalTo=2 sets the marshaller to text message rather than bytes message-->
所以我觉得可能是我错过了什么。我已经尝试在值中使用int,但这也不起作用
我想使用XML配置,因为我使用的是Spring集成,不想使用Java将bean从应用程序上下文中拉出
我使用的是Spring版本3.2.1。释放
# 1 楼答案
我错过了一些东西。。。我在看文件找他
但我用的是
其中包含方法toTargetType()
我不确定是否应该删除我的问题或将其留在这里,以防其他人也这样做