1. Course overview and setup
10m

πŸ‘‹ Welcome to Data loaders with Java & DGS!

We're excited you're here! Together we'll set our sights on improving performance in our applications, zooming in on the best practice of using data loaders. We've got lots of hands-on opportunities ahead, and you'll find quizzes and challenges to test your understanding as we tackle this topic.

In this course, we'll address one of the sneaky performance problems that can appear in projects: the n+1 problem. Once we understand how this problem occurs, we'll implement the solution using data loaders. We'll walk through the steps of implementing and using data loaders in our DGS project, and see the direct effect they have on our app's performance.

Let's jump in!

What we're building

To explore this topic, we'll build on top of an existing app called: Airlock.

Mockup of Airlock

Airlock is an intergalactic trip booking app: a resource we can use to find a cool place to stay in the wide open universe! We built the basics of this in the Intro to GraphQL course.

But don't worryβ€”you don't need to have completed the first course before starting! We'll give you a fresh repo to clone, and walk you through all the steps to get data loaders up and running.

Let's get everything ready to start building!

Project setup

To follow along with the course, you will need the following:

Prerequisite knowledge

We assume that you are familiar with concepts like types, queries, and . Check out our Intro to GraphQL with Java & DGS course if you need a refresher. In this course, we're using the Domain Graph Service (DGS) framework. DGS was created by the Netflix team and it enables in a Spring Boot application with the addition of just a few dependencies.

You should also feel comfortable with Java programming concepts, (this course uses JDK 17) and the basics of Spring Boot.

Code editor or IDE

Many popular IDEs offer plugins that enable syntax highlighting. For IntelliJ, we recommend the GraphQL plugin.

Clone the repository

This course picks up where Intro to GraphQL with Java & DGS left off, but completing it first isn't a prerequisite! To start fresh, run the following command.

git clone https://github.com/apollographql-education/odyssey-dataloaders-dgs.git

Running the app

Finally, let's get our server up and running.

Open the odyssey-dataloaders-dgs directory in your IDE and navigate to the main ListingApplication file located in the com.example.listings package. This is the starting point for our app.

@SpringBootApplication
public class ListingApplication {
public static void main(String[] args) {
SpringApplication.run(ListingApplication.class, args);
}
}

In IntelliJ, we can click the handy green play button in the margin next to the main function, or the one located at the top of the interface.

Alternatively, you can open a new terminal to the root of your project and run the following command:

./gradlew bootRun

In the IDE Run output, we should see that our app is running!

> Task :ListingApplication.main()
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.2.0)
Task!

Up next

Let's get into data loaders, the problem they solve, and how we bring them into our application.

Next

Share your questions and comments about this lesson

This course is currently in

beta
. Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.

You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.