Skip to content

RabbitTestHarness on proxied Beans #1157

Closed
@Iggle

Description

@Iggle

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions