Skip to content

Configure exception resolver for @GraphQlExceptionHandler methods #34526

@rstoyanchev

Description

@rstoyanchev

@GraphQlExceptionHandler methods declared in controllers or @ControllerAdvice are now supported as of spring-projects/spring-graphql#160 as a built-in feature of AnnotatedControllerConfigurer, and this is automatically applied to controller method invocations with no further configuration needed.

To apply @ControllerAdvice exception handling to other (non-controller) DataFetcher implementations like QueryDslDataFetcher, QueryByExampleDataFetcher, and others, it is necessary to obtain a DataFetcherExceptionResolver from AnnotatedControllerConfigurer and plug that into the GraphQlSource builder, and so a small update in the Boot starter is required for this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions