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?
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.