spring-projects / spring-projects/spring-graphql
@BatchMapping triggers the registration of a data fetcher imperatively in the global data loader registry
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 336
- PR merge metrics
- No merged PRs in 30d
Description
In the default Spring Boot configuration, there can be only one GraphQL endpoint. To have more than one, Spring GraphQL beans needs to be redefined, duplicated as needed. So far so good, especially since the lastest addition of controllerPredicate on the AnnotatedControllerDetectionSupport via #1275.
I am still hitting an issue with a such configuration though. @BatchMapping annotations trigger the registeration of data fetchers. But the registry being used to register them is fetched from the application context. In my project, I have many, and I don't even put them in the application context.
The issue seems to be in AnnotatedControllerConfigurer#registerBatchLoader
Could the BatchLoaderRegistry be injected in the AnnotatedControllerConfigurer rather than fetched from the application context ?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/AnnotatedControllerConfigurer.java at registerBatchLoader, then trace how the BatchLoaderRegistry is obtained. Check the multi-endpoint configuration described in the issue and verify that @BatchMapping registration uses the intended registry rather than an unrelated application-context bean. Done means multiple GraphQL configurations can register their batch loaders independently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100