Following a question I made yesterday, I found some issues with the ExpressionEvaluatingRequestHandlerAdvice because it isn't working as I expected.
I tried the doc example and my expectation were to get two AdviceMessage: one saying "good was successful" and another one saying "bad was bad, with reason..." but when I run the code I get an AdviceMessage and an ErrorMessage.
AdviceMessage [payload=good was successful, headers={id=2eb612ea-d3cd-f853-3295-236505a130f3, timestamp=1611307975199}, inputMessage=GenericMessage [payload=good, headers={id=725e89ea-be09-7534-1b29-5c7412a99a79, timestamp=1611307975196}]]
ErrorMessage [payload=org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice$MessageHandlingExpressionEvaluatingAdviceException: Handler Failed; nested exception is java.lang.IllegalStateException: Could not invoke the method 'public java.lang.Object com.example.demo.EerhaApplication$$Lambda$299/0x00000008401d7040.handle(java.lang.Object,org.springframework.messaging.MessageHeaders)', failedMessage=GenericMessage [payload=bad, headers={id=7639425f-7676-d521-5994-4c74e5b09f4a, timestamp=1611307975200}], headers={id=aaa07286-4bc3-71e5-09fb-6b55a46e0ecf, timestamp=1611307975201}]
Apparently an Exception is always thrown evaluating the failureExpression never getting the desired result.
I'm using Spring Boot 2.4.2 but I've also tried with older versions, having always the same behaviour.
What am I doing wrong?