Skip to content

MicronautTest that acts as @ClientFilter causes stackoverflow #1228

@sdedic

Description

@sdedic

Expected Behavior

A bean that is annotated by @ClientFilter can declare @RequestFilters according to the documentation. I needed a test to always include some
computed headers in a client's request, so I've annotated the test (@MicronautTest) with a @ClientFilter, and added headers in a @RequestFilter annotated method.
I expected that all outgoing requests from the tests will be decorated

Actual Behaviour

The test actually threw StackOverflowError. See the example code in the demo application, class com.example.clientfilter.ClientFilterOverflow. When a separate bean class is annotated with @ClientFilter, the request goes OK.

If not fixable or not a bug, please document that @ClientFilter cannot be used directly at the test class.

Steps To Reproduce

  1. Clone the example app, https://github.com/sdedic/micronaut-dbbugs2, branch clientfilter_stack
  2. Run the test ClientFilterOverflow

Environment Information

  • Ubuntu Linux 22.04
  • Micronaut 4.7.6

Example Application

https://github.com/sdedic/micronaut-dbbugs2

Version

4.7.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions