Skip to content

@GraphQlExceptionHandler method fails with "No registration for controller type" message if controller has proxy #710

Closed
@Marthym

Description

@Marthym

Hi,

I get this error when my controller return an exception : No registration for controller type: MyGqlController$$SpringCGLIB$$0
In this error we can see $$SpringCGLIB$$0 at the end of the class name and it should be the reason for this message.

In my controller I have

    @MutationMapping
    public Mono<Object> testMethod() {
        return Mono.error(new NoSessionException("User is not logged on !"));
    }

    @GraphQlExceptionHandler
    public GraphQLError handle(NoSessionException ex) {
        return GraphqlErrorException.newErrorException()
                .message(ex.getLocalizedMessage())
                .errorClassification(ErrorType.NOT_FOUND)
                .build();
    }

In the AnnotatedControllerExceptionResolver , in resolveException the this.controllerCache key was the original class name, not the proxy class name. So the controller (proxy) class was not found in controllerCache.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions