Closed
Description
Currently, if a Listener Bean contains transactional methods it is wrapped in a cglib proxy, as expected, to ensure transactionality. RabbitTestHarness can thus not produce functioning spies of the Listener as all the proxy's methods are final.
Possible solutions would be to either:
- Return a Mock with AdditionalAnswers.delegatesTo() instead of spy()
- Unwrapping the proxy before spying with Advised.getTargetSource().getTarget()
While only functionally a spy in behaviour, having a look at SpyDefinition.createSpy for @SpyBean, the first option seems to be an effective way to go.
If desired, I could draft up a merge request.