Search code examples
springspring-integrationspring-el

Spring Expression Language (SpEL) for Array Method Parameters


I have a Spring Integration project where I am trying to call a method on a bean that takes a String object and Class object as parameters. The class object I want to pass to it is Long[].class but I can't figure out the correct syntax. I've tried various combinations of the following to no avail:

expression="@parser.readValue(payload, T(java.lang.Long[]))"

For now I've simply wrapped the call in another java class (hardcoding the Class type) and call that via SpEL. What is the correct syntax for an array class parameter?


Solution

  • This works...

    ...(payload, new java.lang.Long[0].class)