Comments (2)
@Batched
in SPQR provides the same semantics as that annotation already provides in graphql-java (note that it belongs to a graphql-java package, not SPQR). It provides a simple batching model that maps well to SQL (and some other) backends. It works with BatchedExecutionStrategy
only.
Dataloader offers a very different strategy. To use dataloader, you must write the batch loader functions yourself and then change your logic to fetch data through the dataloader instead of directly. Unlike the previous model, it's not down to the execution strategy, but down to how you write your datafetchers. SPQR doesn't know what your methods do, so you need to change your own code to use the dataloader.
You might want to create a DataLoaderRegistry
per request, and stick into the global context. This way you can easily inject it into your resolver methods via @GraphQLRootContext
. Or, since you're using Spring, make DataLoaderRegistry
a request scoped bean that you inject into your service classes.
You must also make sure to register a DataLoaderDispatcherInstrumentation
to dispatch the batch jobs. But this is all completely external to SPQR.
Keep in mind, SPQR only really deals with assembling the schema and wiring your methods as datafetchers. Actually executing the queries you do using graphql-java directly.
from graphql-spqr.
You can see a simple example of using @Batched
in BatchingTest
from graphql-spqr.
Related Issues (20)
- Setup GitHub Pages for documentation
- Apply bean validation annotations only if an appropriate group is enabled [Breaking]
- How to use executionResult data HOT 2
- Failing tests - ComplexityTest class
- Explicitly register Java classes to the GraphQL schema. HOT 4
- How to map a java class to GraphQL interface without using @GraphQLInterface annotation? HOT 5
- Best way to error handling HOT 1
- Help in Handling Exceptions with SPQR HOT 1
- Question: Extending an InputObject type and handle it in SPQR HOT 3
- SDL Printing Fails on Schema Directives with Arguments HOT 4
- Spring 3.2: Cannot resolve parameter names for constructor public io.leangen.graphql.spqr.spring.web.dto.GraphQLRequest(java.lang.String,java.lang.String,java.lang.String,java.util.Map) HOT 2
- Compile parameters to support Spring Boot 3.2.1 (Spring Framework 6.1) HOT 1
- null values sent in response json HOT 1
- Schema Generation Regression in 0.12.4 HOT 1
- Polymorphism type on input
- Scalars containing an Instant cannot be serialized over subscription
- Schema generation at compile time?
- BUG: The DelegatingTypeResolver breaks when updating the GraphQLSchema using a Visitor HOT 1
- Feature Request: Add support for GraphQLOutputType to the SchemaTransformer HOT 39
- Make a public OperationMapper#createResolver overload to help with creating custom field resolvers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-spqr.