Six-Project Series

REST Services with Spring and JPA you own this product

prerequisites
basic Java • basic Docker and Docker Compose • basic JSON • basic YAML • basic XML • basic SQL • IDE • Postman or equivalent software
skills learned
Make an application with Spring Boot, expose REST services with Spring Web, generate a SwaggerUI and OpenAPI docs with Springdoc, access a database with Spring JPA, manage database versions with Liquibase, Secure a REST API with Spring Security and OAuth 2, run an application in Docker Containers
Potito Coluccelli
6 weeks · 6-8 hours per week average · BEGINNER

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Take on the role of backend developer at BestInsurance, an insurance company that hopes to attract more customers by offering new life insurance policies. In this series of six liveProjects, you’ll extend the features of BestInsurance’s online portal by adding an API where customers can register and subscribe to the new policies. Using Spring JPA and Spring Web, you’ll build a basic Spring Boot application, create a persistence layer for it to preserve data, and implement RESTful create, read, update, and delete (CRUD) services that allow employees to manage and query data as needed. To improve the employee user experience, you’ll add REST services, such as pagination and aggregate functions, that decrease page latency. You’ll finish by securing the API with Spring Security, ensuring it meets BestInsurance's high standards. When you’re finished, you’ll have the experience and skills to implement production-ready, secure REST APIs using Spring Framework.

These projects are designed for learning purposes and are not complete, production-ready applications or solutions.

This project goes in depth in many important aspects of Spring Boot.

Rupa Lahiri, freelance software developer

liveProject author Potito Coluccelli shares what he likes about the Manning liveProject platform.

here's what's included

Project 1 Dockerized Spring Boot

BestInsurance, an insurance company, wants to attract new customers. As a backend developer, your task is to extend the features of the company’s portal to let customers subscribe to new policies. You’ll use Spring Initializr to create the project structure for a basic Spring Boot application, and you’ll configure the necessary dependencies. You’ll build Docker images for running the application, using both Maven and Gradle plugins, and you’ll create Docker compose services for running the application using your Docker images. When you’re done, you’ll have built a basic Spring Boot application that’s ready to connect to a database.

Project 2 Connect to a Database

BestInsurance, an insurance company, has an online portal with a newly built application for providing features it hopes will attract new customers. As a backend developer, it’s your job to create the persistence layer for the application. You’ll define the database tables and configure a Liquibase changelog to automatically create the tables using SQL. This will allow you to track and manage database versions in order to avoid data loss in production when you change the model. To persist your data, you’ll map Java classes to the database tables using Spring JPA, then implement the basic create, read, update, and delete (CRUD) operations through the JPA repositories for the persistent entities. To verify your mapping is correct, you’ll implement unit testing with JUnit 5 tests, TestContainers, and a PostgreSQL database.

Project 3 CRUD Operations

BestInsurance has an online portal with a newly built application for providing features it hopes will attract new customers. As a backend developer for the insurance company, it’s your job to implement create, read, update, and delete (CRUD) services that allow front-office staff to manage and query data as needed to perform their daily tasks. You’ll define your CRUD API, using Spring Web and the DTO pattern, and observe your components in action. Leveraging inheritance and generic types in Java, you’ll refactor the code as necessary and complete the implementation of your RESTful APIs. To ensure your solution meets BestInsurance’s high standards, you’ll test the services with Spring Test and MockMvc.

Project 4 Advanced Queries

Thanks to its newly built API where customers can subscribe to policies, BestInsurance is anticipating steep growth in its customer base. As a backend developer for the insurance company, your task is to extend the features of the RESTful API that exposes the create, read, update, and delete (CRUD) operations to support the front-office staff. You’ll enhance the API’s search capabilities with custom filters, using Query Methods, Query by Example, and JPQL—empowering front-office staff to locate the specific data they need. Using Spring Test and MockMvc, you’ll test the services, ensuring your new features meet BestInsurance’s high standards.

Project 5 Back Office Services

BestInsurance has a rapidly growing customer base and happy front-office employees, thanks to a newly built API that lets customers subscribe to policies and lets front-office employees narrow their searches with custom filters. But the back-office staff is unhappy with the high latency of the user interface. As a backend developer, you’ll solve this problem by adding pagination with Spring Data JPA, preventing the page from loading all the customer data at once. You’ll use JPQL to add aggregate functions that return information the back office needs, such as revenue and customer count by state. You’ll implement a REST service for uploading policy subscription data provided in CSV format and importing it into your database. You’ll also leverage domain events for sending messages when subscriptions are saved, updated, or deleted. When you’re done, you’ll know how to add REST API services, and the back-office employees will thank you for making their jobs easier!

Project 6 Spring Security

As a backend developer for BestInsurance, your task is to secure its RESTful API using Spring Security. The insurance company is running the API in a server that supports OAuth 2.0 authentication. Using the server’s specs, you’ll reproduce the behavior of the authorization server with Spring Security in order to have a local server that is easily configurable for testing purposes. You’ll implement role-based authorization based on the content of JSON Web Tokens (JWT), from the authorization server point of view. This authorization will impact API security, so you will implement a resource server with Spring Security. You’ll also implement unit testing with Spring Security Test, and configure SwaggerUI to make requests that are authorized according to OAuth 2.0, using SpringDocs. When you’re finished you’ll have highly useful Spring Security skills—and confidence that your API is secure!

book resources

When you start each of the projects in this series, you'll get full access to the following book for 90 days.

choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • REST Services with Spring and JPA project for free

project author

Potito Coluccelli

Potito Coluccelli is a senior software engineer and team leader at Econocom in Italy, where he works on service-oriented architecture design and implementation as well as supporting customers as they transition from monolithic to microservice architectures. Previously he worked as a middleware consultant at Red Hat and supported companies in Italy and the EU with JEE application design, development, maintenance, and testing. With his team, he created a trade surveillance tool for Commodity Markets that’s been adopted by major energy providers in Italy.

Prerequisites

These liveProjects are for beginner and intermediate Java programmers interested in learning how to design and implement REST services using Spring and JPA. To begin these liveProjects you’ll need to be familiar with the following:

TOOLS
  • Basic Java SDK 17
  • Basic Docker and Docker Compose
  • Basic PostgreSQL
  • Spring Boot 3.1.x stable version
TECHNIQUES
  • Define and implement Maven and Gradle projects
  • Define and compose Docker containers
  • Model entity relationships
  • Define Spring Boot configuration classes
  • Define Spring Beans and Entity classes
  • Implement a Liquibase changelog
  • Define OpenAPI REST services
  • Define REST Services using Spring Web
  • Implement the DTO pattern
  • Perform integration testing using Spring Test
  • Implement custom queries
  • Implement aggregate functions, sorts, and native queries
  • Use Spring Security for authentication and role-based authorization

you will learn

In this liveProject series, you’ll learn to design and implement REST services using Spring and JPA.

  • Create and configure a "Containerized" Spring Boot application that saves data on a "Containerized" PostgreSQL database server
  • Create an object-relational mapping (ORM) with Hibernate and Spring JPA
  • Define and implement REST services using Spring MVC
  • Secure REST services with Spring Security

features

Self-paced
You choose the schedule and decide how much time to invest as you build your project.
Project roadmap
Each project is divided into several achievable steps.
Get Help
While within the liveProject platform, get help from other participants and our expert mentors.
Compare with others
For each step, compare your deliverable to the solutions by the author and other participants.
book resources
Get full access to select books for 90 days. Permanent access to excerpts from Manning products are also included, as well as references to other resources.