I was writing the route in which "to" endpoint was need to be configured dynamically with the URL coming in the body. I was trying to use simple expression language (e.g. ${in.header.test} where test is the property set in the in-message header) also with header method (e.g. header(test)). The routes for the same were: from("direct:test").to("${in.header.test}"); & from("direct:test").to(header("test")); after literally every thing i could have. I figured out recipientlist can do the trick e.g. from("direct:test").recipientList("${in.header.test}"); & from("direct:test").recipientList(header("test")); Hope this works for you too.
My Opinion.