
Learn reactive GraphQL concepts for Java Spring Boot developers, covering GraphQL basics, query construction, server efficiency with custom data feature and operation caching, and building a crud app with microservices.
GraphQL is a strongly typed query language and runtime that fetches exactly the data you request, enabling joined queries across services and avoiding overfetching and REST back-and-forth.
Master GraphQL scalar types such as int, float, string, boolean, and ID, and build custom types with non-null fields and lists.
Set up a GraphQL playground project with spring boot using spring initializer, Maven, Java 21, and GraphQL spring dependencies; import, refresh Maven, and prepare for a hello world example.
Configure spring properties to explicitly define your GraphQL setup, including the schema file location under src/main/resources/graphql and the endpoint /graphql.
Expose a hello world GraphQL endpoint by creating a schema in src/main/resources/graphql, defining a query sayHello that returns a string, and wiring a GraphQL controller with a query mapping.
Learn how query mapping aligns a spring method with the graphql schema using alias arguments, then refresh the schema to reflect changes and return Hello World instead of null.
Explore how to pass arguments to a GraphQL backend with query mapping, define a name argument in the schema, and return a dynamic hello message based on client input.
Learn how non-null arguments enforce required fields in GraphQL schemas, using exclamation marks to demand input and showing client-side validation through strong typing in GraphQL for Java Spring Boot developers.
Learn how to align client input with the GraphQL schema in spring by mapping arguments, supplying a name field, and verifying changes after restarting the application.
Discover how GraphQL differs from rest by building a single query that returns hello and random data, avoiding multiple requests and giving clients precise control over responses.
Explore how a GraphQL server uses a schema, resolvers, and reactive types to execute multiple fields in parallel via HTTP post, delivering a non-blocking, single response.
Restructure the project into section zero one and lecture zero one to revisit graphical concepts, moving the graphical controller and GraphQL schema under the new structure and validating with tests.
Create a custom GraphQL object type for customers, define a query API to fetch all customers, fetch by id, and filter by name with non-null guarantees.
Define a reactive customer entity with id, name, age, city, and a GraphQL service exposing flux-based queries to fetch all customers, by id, and by name.
create a reactive customer controller wired to the customer service, exposing endpoints for listing all customers, fetching by id, and filtering by name using query mappings and parameters.
Demo shows configuring the GraphQL schema, scanning packages, and querying customers by selecting fields like name and city to reduce latency, including id-based lookups and name contains filters.
Expose a GraphQL API to filter customers by age range using an input type. Pass an age range input as a filter object to return matching customers.
Explore how to model nested objects in GraphQL by defining a customer and a related customer order type, including id, description, and price, and expose them via a customers query.
Build an order service for nested objects by modeling customer orders with a data transfer object and exposing a reactive method that returns a flux of orders by customer name.
Explore how fields are resolved in a GraphQL approach by stitching data from separate customer and order services, exposing only needed fields and avoiding unnecessary calls.
Learn how fields resolve in GraphQL by using schema mapping and parent objects to access customer and orders, enabling GraphQL to fetch data only when requested.
Demonstrates nested objects aggregation in a reactive GraphQL demo for Java Spring Boot developers by loading the schema, querying customers and their orders, and validating field-level data with logs.
Demonstrates GraphQL nested object execution: root fetch runs in parallel, then per-customer orders resolve, revealing inefficiency of one call per customer and the need for batch optimization.
Apply a limit argument to the customer orders field in GraphQL to fetch only a specified number of orders per customer, using an integer parameter to control results.
Explain the N+1 problem in GraphQL and demonstrate a batch mapping fix that fetches all customers in one call and retrieves their orders in a single batch.
Explore the n+1 problem in a GraphQL context with a live demo, load the schema from lecture four, and observe reduced method invocations and cleaner logs when fetching orders.
Explore resolving the N+1 size mismatch in reactive GraphQL with Java Spring Boot by handling empty results and using default empty collections to guarantee one output per input name.
Identify the N+1 order mismatch in reactive queries caused by parallel flatMap emissions, and apply the simple fix by using flatMap sequential to preserve order.
Explore an alternative fix for the N+1 problem by returning a map of customers to their orders, using collectMap with tuples to build the key-value pairs.
Demonstrate how GraphQL resolves each field with dedicated resolver functions, showing how a customer's fields like age and orders can be overridden and connected to the client.
Learn to structure a multi-file GraphQL schema in a spring boot app, creating address and account types and a dedicated address controller to resolve nested data for customers.
Demonstrates fetching address and account data from multiple controllers via schema mapping with customer objects, showing account id, amount, and account type and data retrieval when the client requests it.
Explore GraphQL scalar types, enums, and schemas. Learn query, mutation, and subscription mappings with parallel reactive resolution and batch mapping to reduce latency and avoid the plus one problem.
Master the use of Altair and Postman to query a GraphQL endpoint, load the customer schema, and fetch specific fields from the GraphQL API.
Use field aliases in GraphQL to customize response labels without altering the server schema, such as renaming account type to type and amount to balance in customer queries.
Demonstrates using field aliases to call the same GraphQL endpoint with different arguments, enabling multiple queries (by id and by age range) in a single request.
Learn how fragments create reusable units in GraphQL to avoid repeating fields. Define a customer details fragment for id, name, age, and city, and apply it with the spread operator.
Explore how operation names in GraphQL enable production monitoring, logging, and caching, while allowing multiple queries in a single request for targeted performance insights.
Declare and use variables in a GraphQL operation, define a $ID variable of type ID, pass values from the client payload, and use default values when none are provided.
Master variable binding in a reactive GraphQL query by declaring three age-range filters for kids, adults, and seniors, and pass corresponding ranges to refine results.
Explore how GraphQL directives like @include and @skip control field resolution at runtime, using boolean conditions and variables to selectively fetch kids or adults data.
learn how to deprecate a field with the deprecated directive, provide a reason, and guide clients to migrate to an age range field, while the documentation explorer shows deprecated fields.
Learn how field aliases, fragments, and operation names optimize GraphQL queries, allowing multiple APIs and argument variations in a single request, with variables and directives for runtime control and deprecation.
Demonstrates data fetching field selection sets in Spring Boot GraphQL controllers, showing how the parent object exposes all requested fields while each child exposes only its own fields.
Explore the data fetching environment, access its selection set and document, and inspect operation definitions and arguments to understand how GraphQL requests are parsed and executed.
Refactor the project structure by removing section prefixes and moving lectures under GraphQL and the playground, clarifying navigation and reducing confusion during updates and rechecks.
Develop and set up a simple project and playground to implement a custom data feature, explore GraphQL's nested object fetching, and prepare the corresponding schema.
Demonstrate the nested objects sequential execution problem in reactive GraphQL by delaying each item emission by one second and logging customer and order emissions, revealing six seconds total latency.
Create a reactive rest controller in Spring Boot that exposes a get endpoint returning a flux of customers with their orders, composing customer and order services.
Compare GraphQL and REST for nested objects by showing parallel fetching of customers and orders, reducing total latency, and discuss how execution control shapes performance.
Demonstrate data fetcher implementation by creating a dedicated customer orders service, conditionally fetching and attaching orders using the data fetching field selection set and a transformer.
Demonstrates wiring a reactive data fetcher to return customers with or without orders and tests performance; fixes a blocking pattern by using flatMapSequence instead of flatMap.
Configure runtime wiring for a GraphQL Spring Boot app by implementing a data feature, wiring the query type and customers field, and returning a flux of customers with orders.
Demonstrates run-time bean wiring by building a data map for customers, returning age 12 and city Atlanta, and wiring data features in a Spring context.
Explore the field glob pattern in GraphQL, construct a nested level one to five schema, and use selection sets with contains and double star checks to navigate the hierarchy.
Explore adding additional scalar types to GraphQL, declare scalars like long, short, byte, date time, local time, and json, and build an all-types schema with a get query.
Create a dto with all scalar fields, including a local date and a car enum, and register long and byte scalars via runtime wiring in a GraphQL Spring Boot setup.
Create a scalar controller to expose an all-types GraphQL object via a query, initializing fields like ID, number, temperature, float, local date, offset date time, and car, and test serialization.
Expose dynamic product attributes as a json scalar by modeling attributes as an object or map, enabling a products endpoint to return products with name and flexible key–value labels.
Understand why GraphQL requires a response for every operation, including deletes, and learn to return a proper type instead of null or fire-and-forget, for Java Spring Boot developers.
Design a GraphQL interface with common fields like id, description, and price that fruit, electronics, and book types implement with category-specific fields such as expiry date and brand.
Expose a GraphQL interface in a reactive spring boot app by implementing a product controller that returns a flux of fruit, electronics, and book.
Verify interface implementation by querying a GraphQL API, using inline fragments to access fruit expiry dates and electronics brands, and reveal concrete types with __typename and aliases.
Configure a type resolver in GraphQL Java to map a class name to a GraphQL type name and wire a config bean to map fruit devo class to fruit type.
Demonstrates how a GraphQL interface models real-life reservations by defining a reservation interface with hotel, car, and flight implementations, exposing common fields and aliasing the type name for unified responses.
Explore how GraphQL union types enable flexible results when a server response can be one of several types, such as fruit, company, or stock.
Design a GraphQL union named result to return fruit, electronics, or book types (and potentially stock or location) for a search keyword, clarifying the schema design.
Implement a GraphQL union to return multiple models (book, electronics, fruit) by updating the type resolver and search controller, then demonstrate randomized, reactive search results.
Explore a GraphQL union demo that queries multiple types, uses inline fragments to request type-specific fields, and demonstrates handling varying results and type-aware client rendering.
Understand how operation caching speeds GraphQL requests by avoiding repeated parsing and validation of identical queries.
Implement operation caching for GraphQL in Spring Boot by parsing and validating once, then caching the pre parsed document entry for subsequent requests using a concurrent map and computeIfAbsent.
Explore operation caching in a GraphQL flow, showing how separating variables from the operation name enables caching, avoids repeated parsing and validation, and improves performance with an lru caffeine cache.
Explore reactive GraphQL data fetching in Spring Boot, covering the data fetching environment, selection sets, field lookahead, runtime wiring, interfaces and unions, and LRU/caffeine caching to prevent memory errors.
Learn GraphQL mutations by building a simple customer CRUD app, mapping common REST operations (get all, get one, create, update, delete) to GraphQL queries and mutations.
Reuse the existing project and add three key dependencies for database connectivity, update the pom.xml, reload Maven, then create GraphQL directories for lecture 13 and begin with schema creation.
Design and implement GraphQL mutation mappings for a customer schema, including create, update, and delete operations with input objects, custom delete responses, and status enums.
Create an entity with id, name, and city; build a reactive repository, a dto, and a utility layer for converting between dto and entity using copy properties.
build a reactive customer service in Spring Boot that handles find all, find by id, create, and update using mono, flatMap, and entity data mapping.
Implement a delete customer flow with a custom delete response object, including id and a status enum (success or failure), returned from the service as a delayed response.
Create a reactive GraphQL CRUD controller with query and mutation mappings to fetch all customers, fetch by id, create, update, and delete, using a customer service and DTO.
Create a database initialization script that drops table if exists custom, then builds a customer table with an auto-incrementing id as primary key, and inserts sample data.
Learn to perform GraphQL CRUD operations: query all customers and by id, and perform create, update, and delete mutations with input variables and mapping.
Learn how GraphQL handles a not-found item by returning null, compare with REST approaches, and preview error handling and update scenarios for non-existent customers.
Explore how GraphQL queries run in parallel while mutations execute sequentially, and learn how the order of operations, specifically create and update, determines execution in a single request.
Learn why you cannot mix query and mutation in a single GraphQL request; send multiple queries or multiple mutations, but choose one type per operation.
Fetch only the requested fields from upstream by using GraphQL to aggregate multiple microservice calls and return just the selected id and name from customer, reducing latency and bandwidth.
Explain how GraphQL handles query and mutation mappings, including parallel queries and sequential mutations, while decoupling from http transport and using null for not found; schemas require type query.
Publish customer events using subscription mapping in GraphQL to stream updates via server-sent events, enabling subscribers to receive real-time notifications such as customer created or deleted.
Design a subscription schema to stream customer events on mutations, defining a customer event with id and action (created, updated, deleted) via a streaming response.
Learn to build a reactive subscription service in Spring by defining a customer event data model, an action enum, and a Flux multicast stream to emit and subscribe to events.
Learn how to emit customer events via a subscription by sending create, update, and delete actions from the customer event service through a GraphQL subscription.
Update application properties to set the spring.graphql.socket.path, align query and mutation mappings to that path, and enable the web socket so the client connects to the same endpoint.
Corrects the setup by making the publisher a hard publisher with cash, defaults to zero cashing, and emits values immediately after updating the application properties file.
Demonstrates a GraphQL subscription with a web socket, showing real-time customer events (create, update, delete) streaming to the UI and handling multiple mutations during testing.
Learn how GraphQL uses a data field and an error field to convey results, independent of http status codes or internal server errors, across http or WebSocket transports.
Set up the project by reusing the lecture 13 credit application, create a new lecture 15 package, copy and paste existing code, and prepare the schema for integration.
Explore how GraphQL handles runtime exceptions by throwing errors in the controller and observe data and errors in responses, with path, line, and column details.
Develop a data fetcher exception resolver to capture runtime errors, create GraphQL error objects with an appropriate error type, and optionally include data fetching environment details.
Discover how to use the GraphQL error extension to attach a key-value map with details like customer id, timestamp, and classification, improving error messaging in a Spring Boot app.
Develop a generic application exception with error type, message, and optional extensions, then define application errors and map them via an exception resolver to meaningful responses.
Demonstrate invoking the playground application to fetch customers by id, showing how custom application exceptions return meaningful not present or bad request messages when a user is absent.
Implement a validation rule on a customer input object to allow creation only when age is 18. Return the input object in the extension while throwing a bad request otherwise.
Validate input age in a reactive Spring Boot app; create the customer when age is 18 or above, otherwise return a bad request with the input.
Explore using a union type to represent outcomes like customer or customer not found, avoiding errors and modeling possible events in a reactive GraphQL workflow.
Develop a Spring configuration type resolver to handle a union type between customer data and not found responses, then create and reuse a fragment for consistent GraphQL queries.
Explore how to access HTTP headers in a GraphQL interceptor for reactive microservices, extract color id, and inject it into execution input for downstream controllers.
Access the GraphQL data fetching environment to read the caller-id header and conditionally tailor the get all customer response in a spring boot interceptor.
Implement a Spring web filter to reject requests at the transport level when required headers, like the caller id, are missing, returning a 400 bad request before GraphQL processing.
Learn how to secure GraphQL using spring web flex security or spring web security, with guidance on annotations on service methods that fetch GraphQL responses.
Explore GraphQL error handling with data and error fields, implement a data fetch exception resolver, and use unions to model outcomes like payment accepted or rejected.
Explore how to build a GraphQL client that sends requests to a GraphQL server and processes responses, using a shared common Maven module and integrated server and client packages.
Create a self-contained GraphQL client in a Spring Boot project, wiring a web client, and sending raw queries via execute to fetch customer data from the customer service.
Develop a reactive Spring Boot client that sends a GraphQL query as a string, maps the response to a customer model, and prints results on startup.
Configure the http localhost GraphQL endpoint in application properties, build a web client, and send a query as a string to receive a response.
Use a field alias in a GraphQL query to rename the response field, and see how the alias becomes the returned data while old fields may be invalid.
Demonstrates storing GraphQL queries as files in resources, loading them at runtime, and sending the query to fetch a customer by ID using variables and a fragment.
Demonstrates a get customer by ID workflow in the service layer, printing execution steps, calling the model client, and showing the ID remains null when not requested.
Refactor a repetitive executor by turning the common logic into a generic method that accepts a message and a publisher, then subscribes to the publisher to print results.
Master GraphQL by building a single query with an alias to fetch multiple fields, testing with hard-coded values and multiple arguments, and decoding and printing response via a graphical tool.
Learn to retrieve the full customer object with the retrieve method in GraphQL, map it to a multi customer data structure, and fetch all fields by passing an empty string.
Learn to use the execute method to fetch the whole object, apply the map method, and return a multi customer assignment entity.
Explore how a GraphQL client handles errors when data is null, including server and client side errors in the error field for a customer by id.
The lecture shows handling GraphQL client errors in a reactive pipeline by returning a default data object or a generic error response to the service layer.
Explore implementing GraphQL union types to handle a not found customer response in a Java Spring Boot app, using interface or object approaches, schema updates, and type resolver configuration.
Decode a GraphQL union on the client by inspecting the type name, aliasing it, and routing to a customer DTO or not found, using JSON path to extract fields.
Demonstrates using a GraphQL client to perform CRUD operations with a fragment, testing in a graphical tool, and organizing operations in multiple files for a Java spring boot workflow.
Explore how to implement a get all customers query in a reactive GraphQL client for Java Spring Boot, using a CRUD operation, aliasing fields, and returning a customer data list.
Fetch a customer by id in a reactive GraphQL workflow for Java Spring Boot, passing the id variable to retrieve the specific customer data as the response.
Refactor the client to reuse a single CRUD method by parsing the operation name and variables, returning a flexible type.
This lecture demonstrates creating a customer via GraphQL, showing how to avoid sending an id field and two fixes: use a dedicated customer input type or configure not-null serialization.
Update a customer via reactive GraphQL by passing user id and request body in a map to the update operation, demonstrated with a demo updating id, name, age, and city.
Execute a delete customer operation by sending the customer id, receive a delete response, and verify a successful status as part of CRUD operations.
Learn to build a dedicated GraphQL subscription client in a Java Spring Boot app using a WebSocket GraphQL client to stream customer events in real time.
Demonstrates wiring a websocket-based GraphQL subscription client in a Java Spring Boot app. Subscribe to customer events and print updates as they arrive.
Learn to pass headers in a web client by setting default headers during build or mutating the client for a single request, enabling authentication tokens and cookie handling.
Explore how to execute GraphQL operations with client strategies, including string queries and documents, variables and operation names, error handling, field serialization, and web socket subscriptions.
Learn how to write integration tests using a GraphQL tester wrapper around the HTTP GraphQL client, execute requests, and verify responses with JSON path.
Set up an integration test project for a GraphQL operation in Spring Boot, using the source/test/java path and a test client, with http GraphQL test configuration via Spring injection.
Write the first GraphQL integration test for CRUD operations on all customers, using a raw query, a Java 17 multi-line string, and client execute.
Perform an integration test using lecture 14 to cover CRUD operations and subscriptions, with a test property source to override properties and validate the query response.
Set up and run a Spring integration test by organizing test resources under source test resources, reading the crud operations file, and validating a get by id response.
Execute the create customer test by sending a request body with the customer data from lecture 16: Michael, 55, Seattle, and verify the response echoes the input with id five.
Execute a reactive GraphQL update operation to modify a customer's id, age, and city in a Spring Boot context, and log or assert the resulting object to verify changes.
Write and validate a GraphQL delete customer test to ensure the response returns the deleted id and a success status, using an assertion library to verify the operation.
Develop and validate a GraphQL error handling test for a create operation with age restrictions, asserting a single graphical error and a bad request response for under-18 input.
Create a Spring Boot integration test for GraphQL subscriptions using HTTP and WebSocket clients, configuring a WS endpoint to observe customer events with id and action.
Demonstrate a reactive GraphQL subscription test with a web socket client, performing delete customer and validating a single customer event via a step verifier.
Discover how reactive GraphQL unifies multiple microservices to power a movie app, loading genres on scroll, showing movie details with reviews, and enabling a watch list and recommendations.
Explore external services across three microservices—customer, movie, and review—via APIs, using a single jar and swagger UI on localhost:7070 to prototype a graph application.
Set up a reactive GraphQL movie app by creating a Spring Boot project with Maven or Gradle, selecting Java 17, and adding GraphQL, WebFlux, and Lombok.
Design a GraphQL schema for a movie app, enabling home page genre queries, movie details with reviews, user profile with watchlist, and mutations to update profiles and include genre enum.
Design a GraphQL movie schema with two views: a summary and a detailed version with reviews, using interfaces and non-null fields to model movie data.
Design the user profile type in GraphQL with id, name, and favorite genre, a watch list of movie summaries, and update inputs for mutations.
Design GraphQL schemas by defining user profile and movie detail queries, genre-based movie lists, and add-to-watch-list mutations with corresponding response types and status enums, plus update profile mutations.
Organize graphql dto objects by splitting the schema into client, controller, and data model packages. Implement movie and review types with Lombok and expose graphql APIs with service-based field resolution.
Continue dto design by adjusting the rating field from integer to double or to string in the GraphQL schema. Display assets on the client side without manipulating the rating.
Master dto design for a reactive GraphQL API by modeling customer input and watch list payloads, using data annotations and shared models to serialize and resolve fields at runtime.
Create a reactive review client in spring by wiring a service component, building a base url, and fetching movie reviews via a get request returning a flux of reviews.
Develop a reactive spring movie client that fetches movies by ids or by genre using query and path parameters, returning Flux<Movie> and handling empty watchlists gracefully.
Builds a reactive customer client that retrieves a profile by id, updates the profile using put, and adds to a watch list via endpoints returning a list of integers.
Learn to implement a get user profile API with GraphQL by wiring a customer controller, schema mapping, and runtime resolution of watch list and recommendations via a movie controller.
Learn how the user profile GraphQL API orchestrates calls to the customer service and parallel movie service requests for watch list and recommendations, executing only requested fields.
Implement a movie details api in GraphQL, exposing a movie by id through the movie controller and resolving reviews at runtime via the review controller, with a movie details object.
Build a reactive GraphQL endpoint that returns a flux of movies by genre, exposed via a query mapping in the movie controller, using genre argument and a separate service layer.
Implement mutation mappings to update the customer profile and add items to the watch list, returning the updated customer with watch list details through the GraphQL schema and related controllers.
Update the application properties to enable GraphQL, set the GraphQL path to /graphql, and configure customer, movie, and review service URLs with http on localhost:27070, ensuring trailing slashes.
Run the demo to validate GraphQL queries by starting external services and launching the app. Explore home page genres, fetch movies by genre, and view fragment-based movie details with reviews.
Load user profiles, favorite genres, and watch lists using GraphQL queries and mutations, reuse a movie summary fragment for recommendations, and apply add-to-watch-list mutations with user and movie IDs.
Update user profiles via GraphQL mutations by applying customer input to set a new favorite genre, then reflect changes in the recommended movies and update the watch list.
Master GraphQL and Spring WebFlux for Building Reactive Microservices
This comprehensive course equips you with the skills to build modern, reactive microservices using GraphQL and Spring WebFlux. You'll gain a deep understanding of GraphQL's query language, schema design, and seamless integration with Spring WebFlux. Explore advanced topics like real-time subscriptions, robust input validation, and effective testing strategies. Through hands-on exercises and practical examples, you'll develop the expertise to architect powerful and efficient microservices.
Course Highlights:
GraphQL Fundamentals: Demystify GraphQL's principles, query language, and schema design. Understand its advantages over traditional REST APIs.
Advanced GraphQL Concepts: Explore subscriptions for real-time updates, input validation, error handling, and effective testing strategies.
Building with Spring WebFlux: Learn how Spring WebFlux empowers the development of reactive GraphQL microservices.
Hands-on Learning: Develop practical skills through exercises and real-world examples.
Architecting Robust APIs: Gain expertise in designing and implementing robust GraphQL APIs, addressing the N+1 problem and optimizing data fetching.
Testing Strategies: Master the art of integrating testing for GraphQL APIs, covering queries, mutations, and subscriptions.
By the end of this course, you'll be able to:
Confidently utilize GraphQL for building APIs.
Design and implement effective GraphQL schemas.
Leverage Spring WebFlux for reactive microservice development.
Build real-time data applications with GraphQL Subscriptions.
Implement robust input validation and error handling mechanisms.
Effectively test your GraphQL APIs, ensuring their functionality and performance.