'GraphQL + SpringBoot + DataLoaders: what is the right pattern?
I have GraphQL + SpringBoot + MongoDB application, with graphql.java.kickstart.springboot ,and I'm having performance issues. The walking skeleton of this application was done the last year and I received it as it is. I'd like to add DataLoaders / BatchDataLoaders (better) to improve the performance and to avoid to query the DB overtime for similar requests. Looking at DataLoaders examples I see quite different implementations from the one I have. I have a QueryResolver class that calls the Service which calls the Repository. The result is exposed from here, not handled by some Resolvers.
@Component
@Slf4j
@AllArgsConstructor
@NoArgsConstructor
public class Query implements GraphQLQueryResolver {
@Autowired
ProjectService projectService;
public Iterable<ProjectDao> listProjects(String name, Sort orderByInput) {
return projectService.getProjects(name, orderByInput);
}
}
Now I don't understand if this is a wrong approach in order to add the DataLoaders. Here I found a question with a similar implementation, but then he seems to have changed looking at this answer. Changing the whole code would be time-consuming and I really hope I'm just missing something. Do you have any tips or docs to suggest? Thank you so much in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
