Resttemplate bean created in springboot accessed in bpmn is not working in bpmn

I have defined a bean named restBean1 for class of type resttemplate.
if I try to save it camunda variable just to verify the accessibility with execution.setVariable(“var1”,restBean1.toString()) - i can see the object getting stored
but when I try to do restBean1.getForEntity(‘url’,String.class)
i get unable to evaluate script

**java.lang.ClassCastException : Cannot cast jdk.nashron.internal.runtime.Underfined to java.lang.class at java.base/

Having script type as javascript for below snippet
was causing the error mentioned above as String.class was not recognised by javascript

updating it as below format worked

Thanks for posting your solution.