问题
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