◐ Shell
clean mode source ↗

Add strict mode for DataLoaderRegistry by AlexandreCarlton · Pull Request #252 · graphql-java/java-dataloader

In a similar vein to graphql-java/graphql-java#3565
which enabled "strict mode" for type wiring (preventing multiple
`DataFetcher`s being registered to the same field on a GraphQL type), we
add "strict mode" to the `DataLoaderRegistry` so that we don't
accidentally register multiple DataLoaders to the same key (which would
result in the last registration winning).

This defaults to `false` to avoid breaking changes.

bbakerman

requested changes Nov 24, 2025

This is done to ensure coverage of all registering locations.

We purposefully omit `computeIfAbsent` as this does _not_ register a new
DataLoader if there is an existing key.

bbakerman