Getting class cast expression while evaluating the spring integration expression

Vishal Zanzrukia

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?

Gary Russell

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related