graphql-java

GraphQL and Data Loader Using the graphql-java-kickstart library

走远了吗. 提交于 2020-06-29 03:55:28
问题 I am attempting to use the DataLoader feature within the graphql-java-kickstart library: https://github.com/graphql-java-kickstart My application is a Spring Boot application using 2.3.0.RELEASE. And I using version 7.0.1 of the graphql-spring-boot-starter library. The library is pretty easy to use and it works when I don't use the data loader. However, I am plagued by the N+1 SQL problem and as a result need to use the data loader to help alleviate this issue. When I execute a request, I end

How to execute Java calls to GraphQL in a Spring Boot + GraphQL Java Tools' context?

天涯浪子 提交于 2020-06-25 06:51:48
问题 In a Spring Boot application, we're already having a fully functional GraphQL endpoint, serving .graphqls files via GraphQL Java Tools (we included the graphql-spring-boot-starter dependency) and handling the data resolution through our base Query class implementing GraphQLQueryResolver and subsequent GraphQLResolver 's. For a business need, we have to re-create standard REST API endpoints, so I wonder why not just making calls to GraphQL (instead of having to re-implement "by hand" the data

Is there a way to expose 2 graphql endpoints using spring boot starter app graphql-spring-boot-starter?

↘锁芯ラ 提交于 2020-06-17 22:54:37
问题 Currently we are using <dependency> <groupId>com.graphql-java-kickstart</groupId> <artifactId>graphql-spring-boot-starter</artifactId> <version>${graphql-spring-starter.version}</version> </dependency> With this, we are exposing our graphql API using /graphql endpoint. I want to have multiple endpoints like this, /graphql1 and /graphql2 so that I can define different response formats based on the endpoints. what is the best way to do it? Any inputs is highly appreciated. 回答1: It just boils

GraphQL Java: Using @Batched DataFetcher

倖福魔咒の 提交于 2020-05-15 03:58:08
问题 I know how to retrieve a bean from a service in a datafetcher: public class MyDataFetcher implements DataFetcher { ... @Override public Object get(DataFetchingEnvironment environment) { return myService.getData(); } } But schemas with nested lists should use a BatchedExecutionStrategy and create batched DataFetchers with get() methods annotated @Batched (see graphql-java doc). But where do I put my getData() call then? ///// Where to put this code? List list = myService.getData(); /////

No qualifying bean of type 'javax.persistence.EntityManager' available: expected single matching bean but found 2

那年仲夏 提交于 2020-05-14 19:59:53
问题 I have two entity manager configurations for two separate databases but when I try to auto-wire an entity manager in to configure my GraphQLExecutor bean I get an exception stating that there are two beans that match the criteria even though I've specified a unit name in the PersistenceContext. Exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphQLExecutor': Injection of resource dependencies failed; nested exception is org.springframework

How do I logically split up my GraphQL schema and Resolvers with Kickstart Spring Boot GraphQL

感情迁移 提交于 2020-04-10 05:20:41
问题 At the moment, all my query resolvers are under a single Query class and a single Query schema / type as such: schema { query: Query #I'd prefer UserQueries and OrganisationQueries mutation: UserMutations mutation: OrganisationMutations } type Query { fetchUser(email: String): User listOrganisations(max: Int): [GenericListing] } ... And all my queries in one class: @Component public class Query implements GraphQLQueryResolver { public List<GenericListing> listOrganisations (Integer max) { ...

How do I logically split up my GraphQL schema and Resolvers with Kickstart Spring Boot GraphQL

江枫思渺然 提交于 2020-04-10 05:20:08
问题 At the moment, all my query resolvers are under a single Query class and a single Query schema / type as such: schema { query: Query #I'd prefer UserQueries and OrganisationQueries mutation: UserMutations mutation: OrganisationMutations } type Query { fetchUser(email: String): User listOrganisations(max: Int): [GenericListing] } ... And all my queries in one class: @Component public class Query implements GraphQLQueryResolver { public List<GenericListing> listOrganisations (Integer max) { ...

How do I logically split up my GraphQL schema and Resolvers with Kickstart Spring Boot GraphQL

假如想象 提交于 2020-04-10 05:20:02
问题 At the moment, all my query resolvers are under a single Query class and a single Query schema / type as such: schema { query: Query #I'd prefer UserQueries and OrganisationQueries mutation: UserMutations mutation: OrganisationMutations } type Query { fetchUser(email: String): User listOrganisations(max: Int): [GenericListing] } ... And all my queries in one class: @Component public class Query implements GraphQLQueryResolver { public List<GenericListing> listOrganisations (Integer max) { ...

How can I use from GraphQl in android?

拥有回忆 提交于 2020-02-20 09:38:48
问题 I need to a simple example for use GraphQl in android . How can I use from GraphQl in android (tutorial). 回答1: In order to use GraphQL (in general), you need two things: 1. A GraphQL server There are a few ways how you could go about this. Of course, you could simply go and implement one yourself in any server-side language you like. Other (faster) approaches are to take advantage of existing tooling and generate a GraphQL API using services like graphql-up or create-graphql-server or even

How can I use from GraphQl in android?

怎甘沉沦 提交于 2020-02-20 09:38:21
问题 I need to a simple example for use GraphQl in android . How can I use from GraphQl in android (tutorial). 回答1: In order to use GraphQL (in general), you need two things: 1. A GraphQL server There are a few ways how you could go about this. Of course, you could simply go and implement one yourself in any server-side language you like. Other (faster) approaches are to take advantage of existing tooling and generate a GraphQL API using services like graphql-up or create-graphql-server or even