imagine we have a POJO class like this:
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MyPojo
{
private Map<String, Object> myMap;
private List<AnOtherPojoClass> myOtherPojos;
private int myInteger;
}
This Type is used in a camel route triggered by REST DSL:
<post uri="/runpojo" consumes="application/json" produces="application/json" bindingMode="json" type="com.test.MyPojo">
<route>
<!-- pojo's myInteger is already filled from REST caller -->
<setBody>
<simple>${body.setMyMap(${bean:service2?method=calculateMap(${body.myInteger})})}</simple>
</setBody>
<setBody>
<simple>${body.setMyOtherPojos(${bean:service3?method=calculateOtherPojo})}</simple>
</setBody>
<marshal ref="json" />
</route>
</post>
But here is my problem: After invoking my POST I want to set a POJO property in my body. But <simple/>
does not work, since it tries to convert calculateMap(${body.myInteger})})
the method parameter to an String. As long as the parameter is a simple type this maybe works, but into my production code myInteger
is an byte[]
. Another problem is, even if I manage to get the bean running, the return value Map<String, Object>
is (camel internal) parsed to a String
, but my setter expect a Map
.
Current version :
<camel.version>2.17.1</camel.version>
What can I do, to set POJO properties to an result of another beans method call?
Thanks, Jan
我敢肯定,我们已将其修复为较新的版本,因此请升级您的Camel。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.