apache camel simple expression not giving string value

三世轮回 提交于 2019-12-11 02:18:35

问题


I am using apache camel. I am trying to retrieve value from body using simple expression language. I need it as a String but simple returns SimpleBuilder object. So I have tried something like this

simple("${body.address.line}").resultType(String.class).getResultType()

but it is returning me java.lang.String. please tell me how can I get this expression's result as String?


回答1:


That is only for configuring the simple expression. If you need to evaluate it then call the evaluate method

String foo = simple("${body.address.line}").evaluate(exchange, String.class);



回答2:


Using xml, we can simply evaluate using

<simple>${body.address.line}</simple>


来源:https://stackoverflow.com/questions/41020936/apache-camel-simple-expression-not-giving-string-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!