Spring in Action, Fifth Edition
Craig Walls
  • October 2018
  • ISBN 9781617294945
  • 520 pages
  • printed in black & white

This new edition is a comprehensive update that strikes the balance between practical instruction and comprehensive theory.

Daniel Vaughan, European Bioinformatics Institute

Spring in Action, 5th Edition is the fully updated revision of Manning's bestselling Spring in Action. This new edition includes all Spring 5.0 updates, along with new examples on reactive programming, Spring WebFlux, and microservices. You'll also find the latest Spring best practices, including Spring Boot for application setup and configuration.

About the Technology

Spring Framework makes life easier for Java developers. New features in Spring 5 bring its productivity-focused approach to microservices, reactive development, and other modern application designs. With Spring Boot now fully integrated, you can start even complex projects with minimal configuration code. And the upgraded WebFlux framework supports reactive apps right out of the box!

About the book

Spring in Action, 5th Edition guides you through Spring’s core features, explained in Craig Walls’ famously clear style. You’ll roll up your sleeves and build a secure database-backed web app step by step. Along the way, you’ll explore reactive programming, microservices, service discovery, RESTful APIs, deployment, and expert best practices. Whether you’re just discovering Spring or leveling up to Spring 5.0, this Manning classic is your ticket!

Table of Contents detailed table of contents

Part 1 : Foundational Spring

1 Getting started with Spring

1.1 What is Spring?

1.2 Initializing a Spring application

1.2.1 Initializing a Spring project in Spring Tool Suite

1.2.2 Examining the Spring project structure

1.3 Writing a Spring application

1.3.1 Handling web requests

1.3.2 Defining the view

1.3.3 Testing the controller

1.3.4 Building and running the application

1.3.5 Getting to know Spring Boot DevTools

1.3.6 Let’s review

1.4 Surveying the Spring landscape

1.4.1 The Core Spring Framework

1.4.2 Spring Boot

1.4.3 Spring Data

1.4.4 Spring Security

1.4.5 Spring Integration and Spring Batch

1.4.6 Spring Cloud


2 Developing web applications

2.1 Displaying information

2.1.1 Establishing the domain

2.1.2 Creating a controller class

2.1.3 Designing the view

2.2 Processing form submission

2.3 Validating form input

2.3.1 Declaring validation rules

2.3.2 Performing validation at form binding

2.3.3 Displaying validation errors

2.4 Working with view controllers

2.5 Choosing a view template library

2.5.1 Caching templates


3 Working with data

3.1 Reading and writing data with JDBC

3.1.1 Adapting the domain for persistence

3.1.2 Working with JdbcTemplate

3.1.3 Defining a schema and preloading data

3.1.4 Inserting data

3.2 Persisting data with Spring Data JPA

3.2.1 Adding Spring Data JPA to the project

3.2.2 Annotating the domain as entities

3.2.3 Declaring JPA repositories

3.2.4 Customizing the JPA repositories


4 Securing Spring

4.1 Enabling Spring Security

4.2 Configuring Spring Security

4.2.1 In-memory user store

4.2.2 JDBC-based user store

4.2.3 LDAP-backed user store

4.2.4 Customizing user authentication

4.3 Securing web requests

4.3.1 Securing requests

4.3.2 Creating a custom login page

4.3.3 Logging out

4.3.4 Preventing cross-site request forgery

4.4 Knowing your user


5 Working with configuration properties

5.1 Fine-tuning auto-configuration

5.1.1 Understanding Spring’s environment abstraction

5.1.2 Configuring a data source

5.1.3 Configuring the embedded server

5.1.4 Configuring logging

5.1.5 Using special property values

5.2 Creating your own configuration properties

5.2.1 Defining configuration properties holders

5.2.2 Declaring configuration property metadata

5.3 Configuring with profiles

5.3.1 Defining profile-specific properties

5.3.2 Activating profiles

5.3.3 Conditionally creating beans with profiles


Part 2 : Integrated Spring

6 Creating REST services

6.1 Writing RESTful Controllers

6.1.1 Retrieving data from the server

6.1.2 Sending data to the server

6.1.3 Updating data on the server

6.1.4 Deleting data from the server

6.2 Enabling hypermedia

6.2.2 Creating resource assemblers

6.2.3 Naming embedded relationships

6.3 Enabling data-backed services

6.3.1 Adjusting resource paths and relation names

6.3.2 Paging and sorting

6.3.3 Adding custom endpoints


7 Consuming REST services

7.1 Consuming REST endpoints with RestTemplate

7.1.1 GETting resources

7.1.2 PUTting resources

7.1.3 DELETEing resources

7.1.4 POSTing resource data

7.2 Navigating REST APIs with Traverson


8 Sending messages asynchronously

8.1 Sending messages with JMS

8.1.1 Setting up JMS

8.1.2 Sending messages with JmsTemplate

8.1.3 Receiving JMS messages

8.2 Working with RabbitMQ and AMQP

8.2.1 Adding Rabbit to Spring

8.2.2 Sending messages with RabbitTemplate

8.2.3 Receiving message from RabbitMQ

8.3 Messaging with Kafka

8.3.1 Setting up Spring for Kafka messaging

8.3.2 Sending messages with KafkaTemplate

8.3.3 Writing Kafka listeners


9 Integrating Spring

9.1 Declaring a simple integration flow

9.1.1 Defining integration flows with XML

9.1.2 Configuring integration flows in Java

9.1.3 Using Spring Integration’s DSL configuration

9.2 Surveying the Spring Integration landscape

9.2.1 Filters

9.2.2 Transformers

9.2.3 Routers

9.2.4 Splitters

9.2.5 Service activators

9.2.6 Gateways

9.2.7 Channel adapters

9.2.8 Endpoint modules

9.3 Creating an email integration flow


Part 3 : Reactive Spring

10 Introducing Reactor

10.1 Understanding reactive programming

10.1.1 Defining Reactive Streams

10.2 Getting started with Reactor

10.2.1 Diagramming reactive flows

10.2.2 Adding Reactor dependencies

10.3 Applying common reactive operations

10.3.1 Creating reactive types

10.3.2 Combining reactive types

10.3.3 Transforming and filtering reactive streams

10.3.4 Performing logic operations on reactive types


11 Developing reactive APIs

11.1 Working with Spring WebFlux

11.1.1 Introducing Spring WebFlux

11.1.2 Writing reactive controllers

11.2 Defining functional request handlers

11.2.1 Handling realistic requests

11.3 Testing reactive controllers

11.3.1 Testing GET requests

11.3.2 Testing POST requests

11.3.3 Testing with a live server

11.4 Consuming REST APIs reactively

11.4.1 GETting resources

11.4.2 Sending resources

11.4.3 Deleting resources

11.4.4 Handling errors

11.4.5 Exchanging requests

11.5 Securing reactive web APIs

11.5.1 Configuring reactive web security

11.5.2 Configuring a reactive user details service


12 Persisting data reactively

12.1 Understanding Spring Data’s reactive story

12.1.1 Spring Data reactive distilled

12.1.2 Converting between reactive and non-reactive types

12.1.3 Developing reactive repositories

12.2 Working with reactive Cassandra repositories

12.2.1 Enabling Spring Data Cassandra

12.2.2 Understanding Cassandra data modeling

12.2.3 Mapping domain types for Cassandra persistence

12.2.4 Writing reactive Cassandra repositories

12.3 Writing reactive MongoDB repositories

12.3.1 Enabling Spring Data MongoDB

12.3.2 Mapping domain types to documents

12.3.3 Writing reactive MongoDB repository interfaces


Part 4 : Cloud-Native Spring

13 Discovering services

13.1 Thinking in microservices

13.2 Setting up a service registry

13.2.1 Enabling a Eureka server

13.2.2 Configuring Eureka

13.2.3 Scaling Eureka

13.3 Registering and discovering services

13.3.1 Configuring Eureka client properties

13.3.2 Consuming services


14 Managing configuration

14.1 Sharing configuration

14.2 Running a configuration server

14.2.1 Enabling Config Server

14.2.2 Populating the configuration repository

14.3 Consuming shared configuration

14.4 Serving application- and profile-specific properties

14.4.1 Serving application-specific properties

14.4.2 Serving properties from profiles

14.5 Keeping configuration properties secret

14.5.1 Encrypting properties in Git

14.5.2 Storing secrets in Vault

14.6 Refreshing configuration properties on the fly

14.6.1 Manually refreshing configuration properties

14.6.2 Automatically refreshing configuration properties


15 Handling failure and latency

15.1 Understanding circuit breakers

15.2 Declaring circuit breakers

15.2.1 Mitigating latency

15.3 Monitoring failures

15.3.1 Understanding Hystrix thread pools

15.4 Aggregating multiple Hystrix streams


Part 5 : Deployed Spring

16 Working with the Spring Boot Actuator

16.1 Introducing Actuator

16.1.1 Configuring the Actuator’s base path

16.1.2 Enabling and disabling Actuator endpoints

16.2 Consuming Actuator endpoints

16.2.1 Fetching essential application information

16.2.2 Viewing configuration details

16.2.3 Viewing application activity

16.2.4 Tapping runtime metrics

16.3 Customizing Actuator

16.3.1 Contributing information to the /info endpoint

16.3.2 Defining custom health indicators

16.3.3 Registering custom metrics

16.3.4 Creating custom endpoints

16.4 Securing Actuator


17 Administering Spring

17.1 Using the Spring Boot Admin

17.1.1 Creating an Admin Server

17.1.2 Registering admin clients

17.2 Exploring the admin server

17.2.1 Viewing general application health and information

17.2.2 Watching key metrics

17.2.3 Examining environment properties

17.2.4 Viewing and setting logging levels

17.2.5 Monitoring threads

17.2.6 Tracing HTTP requests

17.3 Securing the Admin Server

17.3.1 Enabling login in the Admin Server

17.3.2 Authenticating with the Actuator


18 Monitoring Spring with JMX

18.1 Working with Actuator MBeans

18.2 Creating your own MBeans

18.3 Sending notifications


19 Deploying Spring

19.1 Weighing deployment options

19.2 Building and deploying WAR files

19.3 Pushing JAR files to Cloud Foundry

19.4 Running Spring Boot in a Docker container

19.5 The end is where we begin



Appendix A: Bootstrapping Spring applications

A.1 Initializing a project with Spring Tool Suite

A.2 Initializing a project with IntelliJ IDEA

A.3 Initializing a project with NetBeans

A.4 Initializing a project at start.spring.io

A.5 Initializing a project from the command line

A.5.1 curl and the Initializr API

A.5.2 Spring Boot command-line interface

A.6 Creating Spring applications with a meta-framework

A.7 Building and running projects

What's inside

  • Building reactive applications
  • Spring MVC for web apps and RESTful web services
  • Securing applications with Spring Security
  • Covers Spring 5.0
  • Over 100,000 copies sold!

About the reader

For intermediate Java developers.

About the author

Craig Walls is a principal software engineer at Pivotal, a popular author, an enthusiastic supporter of Spring Framework, and a frequent conference speaker.

placing your order...

Don't refresh or navigate away from the page.
print book $49.99 pBook + eBook + liveBook
includes previous edition eBook
Additional shipping charges may apply
Spring in Action, Fifth Edition (print book) added to cart
continue shopping
go to cart

eBook $39.99 3 formats + liveBook
includes previous edition eBook
Spring in Action, Fifth Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks