Vishal Zanzrukia
Vishal Zanzrukia

Reputation: 4973

Getting class cast expression while evaluating the spring integration expression

I am getting class cast exception while compiling below expression with Spring Integration.

Exception :

Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.Class to type java.lang.String

Expression:

<int:transformer expression=
        "((#{T(my.package.exceptions.MyCustomException)})
payload.getCause()).getMyCustomStringAssociatedWithExceptionInstance()" />

Any help?

Upvotes: 0

Views: 275

Answers (1)

Gary Russell
Gary Russell

Reputation: 174584

You can't cast with SpEL (it's not Java); but you don't need to - you can simply use

expression="payload.cause.myCustomStringAssociatedWithExceptionInstance"

Magic!

You can use explicit getters too, but SpEL will use them implicitly.

Upvotes: 1

Related Questions