Skip to main content
Version: 7.x.x

Spring Server Overview

graphql-kotlin-spring-server is a Spring Boot auto-configuration library that automatically configures beans required to start up a reactive GraphQL web server.

WebFlux vs WebMVC

This library is built on a Spring WebFlux (reactive) stack which is a non-blocking alternative to a traditional Spring Web MVC (servlet) based stack. Since the frameworks utilize different threading models they cannot and should not be intermixed. When building a GraphQL server using graphql-kotlin-spring-server all your queries and mutations should follow one of the supported asynchronous execution models.


The simplest way to create a new Kotlin Spring Boot app is by generating one using Spring Initializr.

Image of

Once you get the sample application setup locally, you will need to add graphql-kotlin-spring-server dependency:

implementation("com.expediagroup", "graphql-kotlin-spring-server", latestVersion)


At a minimum, in order for graphql-kotlin-spring-server to automatically configure your GraphQL web server you need to specify a list of supported packages that can be scanned for exposing your schema objects through reflections.

You can do this through the spring application config or by overriding the SchemaGeneratorConfig bean. See customization below.

- "com.your.package"

Default Routes

Your newly created GraphQL server starts up with following preconfigured default routes:

  • /graphql - GraphQL server endpoint used for processing queries and mutations
  • /subscriptions - GraphQL server endpoint used for processing subscriptions
  • /sdl - Convenience endpoint that returns current schema in Schema Definition Language format
  • /graphiql - An official IDE under the GraphQL Foundation

Note: /playground - Prisma Labs GraphQL Playground IDE endpoint is still available, but need to be configured through the Spring Properties

GraalVm Native Image Support

GraphQL Kotlin Spring Server can be compiled to a native image using GraalVM Ahead-of-Time compilation. See Gradle plugin and/or Maven plugin documentation for details.