Spring for GraphQL provides transport and an annotation model for exposing GraphQL APIs. It is supported with a dedicated Starter as of Spring Boot 2.7.0
Questions tagged [spring-graphql]
87 questions
1
vote
0 answers
Can I add custom GraphQlWebSocketMessage as "start", When I try to executeSubscription?
I'm trying to executeSubscription using WebSocketGraphQlClient
webSocketGraphQlClient.document("subscription onCommentsAdded { comment}")
.executeSubscription().
.subscribe();
Springboot version 2.7.10
When above…

vedpathak supriya
- 11
- 2
1
vote
1 answer
Is there a way to add a second graphql endpoint in a spring-graphql project?
The background is that one endpoint is only intended for use within a data center and the other is intended to be publicly accessible.
I read the documentation, but this topic is never mentioned.

Wilhelm
- 11
- 1
1
vote
1 answer
Spring Boot v3.0.2: Spring GraphGL Serialization/Deseralization Ignoring Enum String Value and @JsonProperty
I'm having an issue with Spring GraphQL not serializing/deseralizing the value of a Java enum, even when using Jackson's @JsonProperty. Example below.
GraphQL Schema Definition
type Media {
name: String
type: MediaType
}
enum MediaType {
…

Joseph Freeman
- 1,644
- 4
- 24
- 43
1
vote
1 answer
Accessing optional parameters in Spring Boot GraphQL
I have this QueryMapping method where I have some parameters marked as required in my GrapthQL schema, but not all. Using @Argument allows me to grab all required parameters, but when I send a Query without an optional parameter it crashes. Using…

Julius Babies
- 955
- 3
- 6
- 22
1
vote
1 answer
GraphQL custom scalar type doesn't work in spring boot application
I've configured GraphQL in spring boot application which uses java 17.
To start application you need gradle bootRun.
To try GrapqQL request you can use curl:
curl -X POST http://localhost:8085/graphql \
-H "Content-Type: application/json" \
…

Sergii
- 7,044
- 14
- 58
- 116
1
vote
1 answer
Spring GraphQLmultiple schemas with Query per file
with Spring-GraphQl if I have following two schemas in the resources/graphql folder:
schema1:
type Query {
bookById(id: ID): Book
}
type Book {
id: ID
name: String
pageCount: Int
author: Author
}
type Author {
id: ID
firstName:…

Tomas Kloucek
- 251
- 2
- 12
1
vote
2 answers
Adding request header to a graphql request using HttpGraphQlClient client
Is there any way to attach a header at the request level to HttpGraphQlClient without client regeneration. I want to attach individual session id of the user to the graphql request.

GJoshi
- 141
- 2
- 9
1
vote
3 answers
Springboot 3 and GraphQL compatibility
I am upgrading my spring boot application from 2.1.6.RELEASE to 3.0.0
After resolving all the errors, the graphql apis are returning null and even the breakpoints are not getting triggered in any of the classes.
Does Spring boot 3 have support for…

theAccidentalDeveloper
- 312
- 1
- 10
1
vote
0 answers
How to write resolver for my query with Spring GraphQL
I need help in writing resolver for my GraphQL query with Spring.
problem is that each of the objects you see here are being passed from different API and I need to combine them with defined dependency. Since Graphql automatically calls instance api…

Ajay Sharma
- 846
- 10
- 21
1
vote
0 answers
Dynamically modify GraphQL schema and see updated schema with GraphiQL
I have a GraphQL schema:
enum CustomType {
Foo
Bar
}
But I need to add enum items from my database. For that, I have made a Visitor that modify the schema model during runtime:
@Configuration(proxyBeanMethods = false)
class GraphQlConfig {
…

Oromis
- 196
- 2
- 13
1
vote
1 answer
Lost authentication when using GraphQL subscriptions with Spring Security
I'm using spring-boot-starter-graphql for my GraphQL server application. I protected the application with basic authentication using Spring security.
GraphQL subscription are used to return a type with a subtype. As soon as subscription returns a…

Aleksandar Stojsavljevic
- 103
- 1
- 5
1
vote
1 answer
Spring GraphQL field type was declared as non-null Error
I recently started using Spring GraphQL to serve the GraphQL request incoming to my server (as opposed to the official GraphQL library).
After this transition, I'm now receiving the following error on SOME requests:
{
"errors": [
{
…

Darius Sas
- 11
- 4
1
vote
0 answers
Hibernate native query that returns an object with nested properties for GraphQL
Is it possible for a native Hibernate/Spring database query to return an object structure that contains nested properties? Ultimately I want to return the data to a GraphQL query. I'm using Spring for GraphQL and want the following request…

Vahid Pazirandeh
- 1,552
- 3
- 13
- 29
1
vote
0 answers
Possiblity to use both SpringBoot graphql and Spring boot web starter
I am building a multi module maven project.
In one module I have my SpringBoot application
And in another module, I have the SpringBoot Graphql controllers.
However, it seems that SpringBoot does not start the GraphQL server.
Did anyone of you…

Pierre Beauregard
- 11
- 1
0
votes
0 answers
spring webflux graphql test giving No qualifying bean of type AnnotatedControllerConfigurer
PFB my code. Getting below error when I run unit test case of below code.
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type…

C P
- 1