Spring Boot GraphQL Tutorial #20 - Listener

Опубликовано: 14 Апрель 2026
на канале: Philip Starritt
4,586
33

The GraphQL Servlet library allows you to add a Servlet Listener for listening to the GraphQL request. It provides hooks into the servlet request execution (request, success, error, and finally).

The Servlet Listener listens to the servlet request, but not to the GraphQL query execution. If you want to listen to that (pre/post resolver methods etc) you should use the Instrumentation provided by GraphQL Java.

In this simple example, I log the complete graphql request execution time.

See AbstractGraphQLHttpServlet for where and when the hook points above are executed.

Thanks,
Philip

Spring Boot GraphQL: https://github.com/graphql-java-kicks...

Java GraphQL Servlet Listener: https://www.graphql-java-kickstart.co...