Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying The Spring Pocket Guide
  • Table Of Contents Toc
The Spring Pocket Guide

The Spring Pocket Guide

By : Josh Long
close
close
The Spring Pocket Guide

The Spring Pocket Guide

By: Josh Long

Overview of this book

The Spring Pocket Guide is a fast-paced, practical tour of modern Spring development, from your first project to production-ready, AI-integrated systems. Starting with Spring Boot and Java 24+, you’ll build a complete microservice-style architecture around a fictional project. Along the way, you’ll explore HTTP endpoints, REST with HATEOAS, GraphQL schemas and resolvers, and high-performance gRPC services. You’ll integrate PostgreSQL (including vector support), consume external APIs with RestClient and declarative interface clients, and secure everything using Spring Security and OAuth 2. But this isn’t just about traditional web services. You’ll go further, building an AI-powered assistant with Spring AI, implementing retrieval-augmented generation (RAG), enabling tool calling, and exposing services through the emerging Model Context Protocol (MCP). The result is a modern, AI-ready Spring architecture built entirely on the “real web”, HTTP. By the end of this guide, you’ll understand how to build secure, scalable, cloud-native, and AI-integrated systems using Spring’s latest capabilities.
Table of Contents (24 chapters)
close
close
Lock Free Chapter
1
The Spring Pocket Guide
2
Who this book is for
3
Get in touch
4
Hands-On Workshop
5
Bootcamp
6
Our map
7
The data and its database
8
HTTP
chevron up
9
REST with Spring HATEOAS
10
GraphQL
11
gRPC
12
Web clients
13
Security
14
Toward a password-free future
15
Federated security
16
Building an assistant with Spring AI
17
Model Context Protocol
18
Scalability
19
GraalVM
20
Building a Docker image
21
Business use cases
22
Conclusion
23
Next steps
24
Index

HTTP

Spring is a component model, but we don’t really have time to get into all of it. What’s important is that you understand you can create Java classes, annotate them, and perhaps specify some configuration in application.properties, and the framework will do most of the heavy lifting. The resulting boost in productivity is unparalleled.

Let’s create a simple HTTP controller with Spring MVC:

@Controller
@ResponseBody
@RequestMapping("/http/dogs")
class MvcHttpController {
    private final DogService dogService;
    MvcHttpController(DogService dogService) {
        this.dogService = dogService;
    }
    @GetMapping
    Collection<Dog> all() {
        return dogService.all();
    }
    @PostMapping("/{dogId}/adoptions")
    void adopt(@PathVariable int dogId, @RequestParam
        String owner) {
        dogService.adopt(dogId, owner);
    }
}

You’ve got two endpoints: /http/dogs, and /http/dogs/{dogId}/adoptions...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
The Spring Pocket Guide
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon