Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Create a REST API with Spring Boot [EN]
Rating: 4.0 out of 5(8 ratings)
1,012 students

Create a REST API with Spring Boot [EN]

Create a REST API with Spring Boot using H2 database then PostgreSQL and Swagger documentation
Created byLearn Time
Last updated 2/2025
English
English [Auto],

What you'll learn

  • Use Spring Web to implement a REST API
  • Use Spring Data to communicate with a database
  • Run a PostgreSQL database using Docker Compose
  • Use Spring's Exceptions Handler to customise errors response
  • Use Spring Doc to generate Swagger documentation

Course content

2 sections8 lectures30m total length
  • Introduction1:11

    Build a rest api with Spring Boot for to-do app by implementing endpoints for get all, create, get by id, update, and delete, with H2, PostgreSQL, validation, exception handling, Swagger.

  • First version of our REST API7:53

    Learn to create a first version of a rest api with spring boot, including a todo model, repository, controller, and CRUD endpoints using spring web, data, h2, and lombok.

  • Testing our REST API3:41

    Launch a Spring Boot API with Maven using mvn spring-boot:run, and test todos with Postman. Create, read, update, delete, and add a validation layer to require a title.

  • Add the validation layer3:48

    Add a validation layer to validate requests and return 400 on invalid input. Create a to do validator with bad request exception and string utils for null or blank checks.

  • Add Global Exception Handlers4:18

    Add a global exception handler with controller advice to return json api errors for 400, 404, and 500 responses, using an api error model and postman tests.

  • Using PostgreSQL database3:01

    Replace the H2 database with PostgreSQL via Docker and docker-compose, update pom.xml and application.properties to auto-create the Todo table, and verify with Postman that two todos exist.

  • Add Swagger documentation6:02

    Add swagger documentation to the rest api by adding the springdoc openapi starter to pom.xml, restart the app, and view endpoint descriptions via swagger ui, using operation annotation for summaries.

Requirements

  • Basic knowledge of the Spring Framework
  • It is also preferable to know Docker

Description

In this course, you will learn how to develop a REST API using Spring Boot.


This course includes:

  • Introduction to Spring Boot: Discover the basics of the framework, its advantages for API development, and how it simplifies the creation of web applications.

  • Configuring an H2 database: We'll start by using H2 in memory, ideal for rapid prototyping, testing and local development.

  • Migration to PostgreSQL: Once the foundations have been laid, we will integrate PostgreSQL for an environment better suited to professional applications and production requirements.

  • Documentation with Swagger: Finally, we will add interactive documentation to our API, making it easier for other developers to use, integrate and maintain.


Skills and technologies covered:

This course will give you the essential foundations for mastering Spring Boot and will include modules on the following technologies and best practices:

  • Managing persistence with JPA and Hibernate

  • Using Spring annotations to simplify code

  • Error and exception handling for a more robust API

  • Setting up a RESTful architecture

  • Introduction to API security with Spring Security


Who should attend?

Whether you're a beginner or a developer looking to expand your knowledge, this course is for you. Not only will you learn how to create API endpoints, but also how to manage requests and responses effectively, configure security, carry out unit and integration tests, and optimise performance.

By the end of this course, you will be able to create a complete, well-documented and secure REST API, ready for deployment in a real environment. Join us to develop your API development skills with Spring Boot, master best practices, and open the door to new rewarding professional opportunities!



Who this course is for:

  • Backend developers wishing to strengthen their skills with Spring Boot
  • Students looking for practical projects to understand the Spring Boot framework