春季消息传递将json字符串转换为地图 [英] spring messaging converting json string to map
本文介绍了春季消息传递将json字符串转换为地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Spring Integration,我有一个json字符串(见下文)和以下代码:
Using Spring Integration and I have a json string (see below) and the following code:
public SomethingBean convert(Message<?> inMessage) {...}
Json字符串
{
"addressIdentification": {
"identifierType": "nemtom",
"addressIdentifier": "eztse"
},
"postcode": "BH1EH",
"country": "5"
}
我想使用以下方法签名:
I'd like to use the following method signature:
public SomethingBean convert(Message<Map<String, ?>> inMessage) {...}
是否可以将json字符串自动转换为Map?
Is it possible to convert the json string to Map automatically?
谢谢, V.
推荐答案
只需使用Spring Integration即可使用的组件:
Just use Spring Integration out of the box component:
<json-to-object-trnsfrormer type="java.util.Map"/>
在您调用SomethingBean
之前.
这篇关于春季消息传递将json字符串转换为地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文