spring message将json字符串转换为map(spring messaging converting json string to map)
使用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。
Using Spring Integration and I have a json string (see below) and the following code:
public SomethingBean convert(Message<?> inMessage) {...}Json string
{ "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) {...}Is it possible to convert the json string to Map automatically?
Thanks, V.
最满意答案
只需使用Spring Integration开箱即用的组件:
<json-to-object-trnsfrormer type="java.util.Map"/>在SomethingBean调用之前。
Just use Spring Integration out of the box component:
<json-to-object-trnsfrormer type="java.util.Map"/>before your SomethingBean invocation.
更多推荐
发布评论