This guide covers breaking changes and required code updates when upgrading to graphql-java v24.x and java-dataloader v4.x/v5.x, as well as the impact on downstream users of this library.
- The mutative
setXXXmethods (e.g.,setStatisticsCollector) now return a builder, not a DataLoaderOptions instance. - You must call
.build()after setting options to get a DataLoaderOptions instance. - Example:
val options = DataLoaderOptions.newOptions() .setStatisticsCollector(::SimpleStatisticsCollector) .build()
- The lambda passed to
DataLoaderFactory.newDataLoadermust have its parameter types specified explicitly. - Example:
DataLoaderFactory.newDataLoader( { keys: List<MyKeyType> -> ... }, options )
- Any code using the old mutative methods (e.g.,
.setStatisticsCollector(...)without.build()) will break.
- All customizations must use the builder pattern and call
.build().
Before:
DataLoaderFactory.newDataLoader(
{ keys -> ... },
DataLoaderOptions.newOptions().setStatisticsCollector(::SimpleStatisticsCollector)
)After:
DataLoaderFactory.newDataLoader(
{ keys: List<MyKeyType> -> ... },
DataLoaderOptions.newOptions()
.setStatisticsCollector(::SimpleStatisticsCollector)
.build()
)- If you expose APIs or extension points that expect users to provide or customize DataLoader/DataLoaderOptions, or if you document/test usage patterns that are now broken, your downstream users will need to update their code to match the new APIs.
- Any direct usage of DataLoaderOptions or DataLoaderFactory will require migration as shown above.
- Update your own documentation and migration guides to highlight these breaking changes.
- Provide migration examples for common usage patterns.
- If possible, add deprecation warnings or migration helpers in your own APIs to ease the transition for your users.
If you have further questions or encounter issues, please open an issue in the repository or consult the official release notes linked above.