About this book

Spring in Action, Fifth Edition was written to equip you to build amazing applications using the Spring Framework, Spring Boot, and a variety of ancillary members of the Spring ecosystem. It begins by showing you how to develop web-based, database-backed Java applications with Spring and Spring Boot. It then expands on the essentials by showing how to integrate with other applications, program using reactive types, and then break an application into discrete microservices. Finally, it discusses how to ready an application for deployment.

Although all of the projects in the Spring ecosystem provide excellent documentation, this book does something that none of the reference documents do: provide a hands-on, project-driven guide to bringing the elements of Spring together to build a real application.

Who should read this book

Spring in Action, 5th edition is for Java developers who want to get started with Spring Boot and the Spring Framework as well as for seasoned Spring developers who want to go beyond the basics and learn the newest features of Spring.

How this book is organized: a roadmap

The book has 5 parts spanning 19 chapters. Part 1 covers the foundational topics of building Spring applications:

  • Chapter 1 introduces Spring and Spring Boot and how to initialize a Spring project. In this chapter, you’ll take the first steps toward building a Spring application that you’ll expand upon throughout the course of the book.
  • Chapter 2 discusses building the web layer of an application using Spring MVC. In this chapter, you’ll build controllers that handle web requests and views that render information in the web browser.
  • Chapter 3 delves into the backend of a Spring application where data is persisted to a relational database.
  • In chapter 4, you’ll use Spring Security to authenticate users and prevent unauthorized access to an application.
  • Chapter 5 reveals how to configure a Spring application using Spring Boot configuration properties. You’ll also learn how to selectively apply configuration using profiles.

Part 2 covers topics that help integrate your Spring application with other applications:

  • Chapter 6 expands on the discussion of Spring MVC started in chapter 2 by looking at how to write REST APIs in Spring.
  • Chapter 7 turns the tables on chapter 6 to show how a Spring application can consume a REST API.
  • Chapter 8 looks at using asynchronous communication to enable a Spring application to both send and receive messages using the Java Message Service, RabbitMQ, or Kafka.
  • Chapter 9 discusses declarative application integration using the Spring Integration project.

Part 3 explores the exciting new support for reactive programming in Spring:

  • Chapter 10 introduces Project Reactor, the reactive programming library that underpins Spring 5’s reactive features.
  • Chapter 11 revisits REST API development, introducing Spring WebFlex, a new web framework that borrows much from Spring MVC while offering a new reactive model for web development.
  • Chapter 12 takes a look at writing reactive data persistence with Spring Data to read and write data to Cassandra and Mongo databases.

Part 4 breaks down the monolithic application model, introducing you to Spring Cloud and microservice development:

  • Chapter 13 dives into service discovery, using Spring with Netflix’s Eureka registry to both register and discover Spring-based microservices.
  • Chapter 14 shows how to centralize application configuration in a configuration server that shares configuration across multiple microservices.
  • Chapter 15 introduces the circuit breaker pattern with Hystrix, enabling microservices that are resilient in the face of failure.

In part 5, you’ll ready an application for production and see how to deploy it:

  • Chapter 16 introduces the Spring Boot Actuator, an extension to Spring Boot that exposes the internals of a running Spring application as REST endpoints.
  • In chapter 17 you’ll see how to use the Spring Boot Admin to put a user-friendly browser-based administrative application on top of the Actuator.
  • Chapter 18 discusses how to expose and consume Spring beans as JMX MBeans.
  • Finally, in chapter 19 you’ll see how to deploy your Spring application in a variety of production environments.

In general, developers new to Spring should start with chapter 1 and work through each chapter sequentially. Experienced Spring developers may prefer to jump in at any point that interests them. Even so, each chapter builds upon the previous chapter, so there may be some context missing if you dive into the middle of the book.

About the code

This book contains many examples of source code both in numbered listings and inline with normal text. In both cases, source code is formatted in a fixed-width font like this to separate it from ordinary text. Sometimes code is also in bold to highlight code that has changed from previous steps in the chapter, such as when a new feature adds to an existing line of code.

In many cases the original source code has been reformatted; we’ve added line breaks and reworked indentation to accommodate the available page space in the book. In rare cases, even this was not enough, and listings include line-continuation markers (). Additionally, comments in the source code have often been removed from the listings when the code is described in the text. Code annotations accompany many of the listings, highlighting important concepts.

Source code for the examples in this book is available for download from the publisher’s website at www.manning.com/books/spring-in-action-fifth-edition as well as from the author’s GitHub account at github.com/habuma/spring-in-action-5-samples.

Book forum

Purchase of Spring in Action, 5th edition, includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum, go to https://forums.manning.com/forums/spring-in-action-fifth-edition. You can also learn more about Manning’s forums and the rules of conduct at https://forums.manning.com/forums/about.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray! The forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

Other online resources

Need additional help?

  • The Spring website has several useful getting-started guides (some of which were written by the author of this book) at https://spring.io/guides.
  • The Spring tag at StackOverflow (https://stackoverflow.com/questions/tagged/spring) as well as the Spring Boot tag at StackOverflow are great places to ask questions and help others with Spring. Helping someone else with their Spring questions is a great way to learn Spring!

About the author

CRAIG WALLS is a principal engineer with Pivotal. He’s a zealous promoter of the Spring Framework, speaking frequently at local user groups and conferences and writing about Spring. When he’s not slinging code, Craig is planning his next trip to Disney World or Disneyland and spending as much time as he can with his wife, two daughters, two birds, and three dogs.

About the cover illustration

The figure on the cover of Spring in Action, 5th edition, is “Le Caraco,” or an inhabitant of the province of Karak in southwest Jordan. Its capital is the city of Al-Karak, which boasts an ancient hilltop castle with magnificent views of the Dead Sea and surrounding plains. The illustration is taken from a French travel book, Encyclopédie des Voyages by J. G. St. Sauveur, published in 1796. Travel for pleasure was a relatively new phenomenon at the time and travel guides such as this one were popular, introducing both the tourist as well as the armchair traveler to the inhabitants of other regions of France and abroad.

The diversity of the drawings in the Encyclopédie des Voyages speaks vividly of the distinctiveness and individuality of the world’s towns and provinces just two hundred years ago. This was a time when the dress codes of two regions separated by a few dozen miles identified people uniquely as belonging to one or the other. The travel guide brings to life a sense of isolation and distance of that period, and of every other historic period except our own hyperkinetic present.

Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now often hard to tell the inhabitants of one continent from another. Perhaps, trying to view it optimistically, we have traded a cultural and visual diversity for a more varied personal life—or a more varied and interesting intellectual and technical life. We at Manning celebrate the inventiveness, the initiative, and the fun of the computer business with book covers based on the rich diversity of regional life two centuries ago brought back to life by the pictures from this travel guide.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset