Building a REST API with Spring Boot
In this beginner course, you’ll learn how to build a complete REST API from start to finish with Spring Boot. With our interactive labs, you’ll get hands-on practice every step of the way — bootstrapping with Spring Initializr, through authenticating & authorizing with Spring Security.
Looking to build a real world REST API using Spring Boot? Ranked as the #1 Java-based development framework for web apps, Spring Boot is an outstanding choice! Here's Spring Developer Advocate, Josh Long, with a quick word on Spring's continuing commitment to education, and why we're so excited to bring you this Spring Boot course.
In This Course
In this course, you’ll build a Family Cash Card service—an app for families to manage allowances in the form of digital debit cards. By building this service from start to finish, you'll learn about REST APIs, Spring Security, data persistence, metrics, and modern application development.
Each lesson follows the same realistic project setting to build a software product. This better prepares you to solve realistic problems that you may encounter throughout the software development lifecycle.
Course Outcomes
- Build a fully functional REST API with Spring Boot.
- Utilize Spring Security to authenticate and authorize your application.
- Implement test-driven development.
- Convert database and Java objects automatically using Spring Data JDBC.
Prerequisites
A working knowledge of the Java language and Java ecosystem
Spring and Spring Boot
Learn about the difference between Spring and Spring Boot, and how to bootstrap a project in 60 seconds with Spring Initializr.
Lab: Spring Initializr
Generate and explore the codebase we will use for our Family Cash Card API.
API Contracts & JSON
APIs have collaborators; how should you collaborate? Learn how to design and transfer data for your Cash Card API.
Testing First
Explore the core principles and benefits of Test Driven Development, and why it pays to test first.
Lab: Testing First
Practice Test Driven Development by test-driving the JSON Contracts that will define our API.
Implementing GET
HTTP, CRUD, and REST – oh my! Learn the basics of API design and implement your first endpoint: the GET endpoint to retrieve a single Cash Card.
Lab: Implementing GET
Put your newfound knowledge to good use by implementing the GET endpoint in our Family Cash Card API.
Repositories & Spring Data
Learn about Separation of Concerns, the Repository pattern, and using Spring Data Repositories to store and retrieve Cash Cards.
Lab: Repositories & Spring Data
Find out how much code you don't have write as you store and retrieve data in our application.
Implementing POST
Learn the HTTP and REST semantics of creating Cash Cards by implementing the HTTP POST endpoint.
Lab: Implementing POST
Our application will start to feel real after you've implemented the ability to create and store new Cash Cards.
Returning a list with GET
You get a Cash Card! And you get a Cash Card! Add additional GET endpoints to your Spring Boot API to retrieve, sort, filter, and paginate multiple Cash Cards.
Lab: Returning a list with GET
Find out how much more Spring Data has to offer as you easily implement paging and sorting lists of Cash Cards.
Simple Spring Security
Learn the differences between authentication and authorization, as well how Spring Security can protect against common security vulnerabilities.
Lab: Simple Spring Security
Add authentication and authorization to our Family Cash Card API using Spring Security, and implement additional best practices for securing our application.
Implementing PUT
Learn how the PATCH
, POST
, and PUT
HTTP verbs are used for Update and Create operations. Make some choices about how to support Update for our API, in preparation for implementing the endpoint!
Lab: Implementing PUT
Implement an HTTP PUT
endpoint that allows an authenticated, authorized owner to update their Cash Cards.
In addition, learn how Spring Security automatically manages error handling by Spring Web to ensure no sensitive information is accidentally revealed when a Controller encounters an error.
Implementing DELETE
Explore different patterns for deleting Cash Cards – sometimes without deleting them at all. You’ll implement one pattern using an HTTP DELETE endpoint.
Lab: Implementing DELETE
Complete our Family Cash Card API by implementing the Delete operation!