Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Exception handlers with CGLIB proxy #736

@pixel13

Description

@pixel13

Describe the bug
The exception handling made with @ExceptionHandler annotated methods doesn't work if Spring beans are proxied with CGLIB (e.g. when Spring AOP is enabled). This is due to the implementation of ReflectiveMethodValidator.isGraphQLExceptionHandler(), which doesn't take care of the possibility that the given method belongs to a proxied subclass of the original class (and thus the method annotations are lost).

To Reproduce
Steps to reproduce the behavior:

  1. Set graphql.servlet.exception-handlers-enabled to true
  2. Create a method annotated with @ExceptionHandler inside a bean
  3. Enable AspectJ autoproxy on the Spring Application (using the specific annotation or just including an Aspect in the application context)
  4. The exception handler is ignored because the annotation is not available on the proxied class

Expected behavior
The exception handler should work even if AspectJ is enabled (that is, if the beans are proxied).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions