From the course: Spring with GraphQL

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Creating a Spring Data repository

Creating a Spring Data repository - Spring Tutorial

From the course: Spring with GraphQL

Creating a Spring Data repository

- [Instructor] Now you can back a GraphQL service with any data source. You could call REST services. And it's something that I encourage you to do, which is use Spring RestTemplate as a data source so that you can expose a GraphQL layer for your microservices architecture. But in this case, we're going to go directly to the database. So we're going to use Spring Data to be our data provider using a built-in in-memory database. Obviously, in the real world, you would back this with a real database. But for now, for demo purposes, the embedded database works great. So let's jump into our IDE. So the first thing that I want you to do is I want you to open up source, main, resources. And I want you to copy from the data directory that I provided in the exercise files the data dot sql and the schema dot sql. And I want you to paste those right into resources. Now, what this allows it to do is that the schema dot sql will…

Contents