我尽力想办法,但失败了。春天的Jaxb2Marshaller似乎忽略了CharacterEscapeHandler!:-(
这是我的代码:
<bean id="aisWsMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPath" value="com.capgemini.manulife.integration.generated.ais.ws.oneshot"/>
<property name="marshallerProperties">
<map>
<entry key="com.sun.xml.bind.characterEscapeHandler" value-ref="noEscapeCharacterHandler">
</entry>
</map>
</property>
</bean>
<bean id="noEscapeCharacterHandler" class="com.capgemini.manulife.integration.NoEscapeCharacterHandler">
</bean>
public class NoEscapeCharacterHandler implements CharacterEscapeHandler {
@Override
public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException {
out.write(ch, start, length);
System.out.println("AAAA");
}
}真的很累:-(
这是 Spring Integration Jaxb2Marshaller Bug!