使用Spring Integration,我有一个json字符串(见下文)和以下代码:
public SomethingBean convert(Message<?> inMessage) {...}
Json字符串
{
"addressIdentification": {
"identifierType": "nemtom",
"addressIdentifier": "eztse"
},
"postcode": "BH1EH",
"country": "5"
}
我想使用以下方法签名:
public SomethingBean convert(Message<Map<String, ?>> inMessage) {...}
是否可以将json字符串自动转换为Map?
谢谢,
V.
最佳答案
只需使用Spring Integration即可使用的组件:
<json-to-object-trnsfrormer type="java.util.Map"/>
在
SomethingBean
调用之前。