春季消息传递将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之前.