Hello, I have noticed that when invoking a bean method with a string parameter, it works but a very special handling is needed to avoid a performance hit. Example code below.
When the parameter is not single quoted or double quoted - Camel tries to resolve the value and in the process tries to load a class by that name which is a very expensive process. This behavior is expected IMO. When the parameter is single quoted or double quoted - Camel still tries to resolve the value as a class name. IMO this is not behaving properly. This issue happens because "StringQuoteHelper.splitSafeQuote(methodParameters, ',', true);" invoked in "MethodInfo.ParameterExpression#evaluate" removes the single/double quotes. Inside "MethodInfo.evaluateParameterValue" the "BeanHelper.isValidParameterValue(exp)" is invoked and returns false and therefor "BeanHelper.isAssignableToExpectedType" > ... > "DefaultClassResolver.loadClass(String name, ClassLoader loader)" is invoked every time the bean method is invoked. The current workaround I found is to add both types of quotes. With this workaround, "MethodInfo.ParameterExpression#evaluate" removes the outer set of quotes but keeps the inner one and "BeanHelper.isValidParameterValue(exp)" returns true. Am I missing anything? Should I open a bug? Thanks. public class MyRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { from("timer:foo?period=2000") .to("bean:myBean?method=myMethod(slow)") .to("bean:myBean?method=myMethod('alsoSlow1')") .to("bean:myBean?method=myMethod(\"alsoSlow2\")") .to("bean:myBean?method=myMethod(\"'fast'\")"); } } public class MyBean { public void myMethod(String str) { System.out.println("str = " + str); } } I am using Apache Camel 3.20.2