
- 520 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
eBook - ePub
Spring in Action, Sixth Edition
About this book
If you need to learn Spring, look no further than this widely beloved and comprehensive guide! Fully revised for Spring 5.3, and packed with interesting real-world examples to get your hands dirty with Spring.
In Spring in Action, 6th Edition you will learn:
Building reactive applications
Relational and NoSQL databases
Integrating via HTTP and REST-based services, and sand reactive RSocket services
Reactive programming techniques
Deploying applications to traditional servers and containers
Securing applications with Spring Security
Over the years, Spring in Action has helped tens of thousands of developers get a major productivity boost from Spring. This new edition of the classic bestseller covers all of the new features of Spring 5.3 and Spring Boot 2.4 along with examples of reactive programming, Spring Security for REST Services, and bringing reactivity to your databases. You'll also find the latest Spring best practices, including Spring Boot for application setup and configuration.
About the technology
Spring is required knowledge for Java developers! Why? Th is powerful framework eliminates a lot of the tedious configuration and repetitive coding tasks, making it easy to build enterprise-ready, production-quality software. The latest updates bring huge productivity boosts to microservices, reactive development, and other modern application designs. It’s no wonder over half of all Java developers use Spring.
About the book
Spring in Action, Sixth Edition is a comprehensive guide to Spring’s core features, all explained in Craig Walls’ famously clear style. You’ll put Spring into action as you build a complete database-backed web app step-by-step. This new edition covers both Spring fundamentals and new features such as reactive flows, Kubernetes integration, and RSocket. Whether you’re new to Spring or leveling up to Spring 5.3, make this classic bestseller your bible!
What's inside
Relational and NoSQL databases
Integrating via RSocket and REST-based services
Reactive programming techniques
Deploying applications to traditional servers and containers
About the reader
For beginning to intermediate Java developers.
About the author
Craig Walls is an engineer at VMware, a member of the Spring engineering team, a popular author, and a frequent conference speaker.
Table of Contents
PART 1 FOUNDATIONAL SPRING
1 Getting started with Spring
2 Developing web applications
3 Working with data
4 Working with nonrelational data
5 Securing Spring
6 Working with configuration properties
PART 2 INTEGRATED SPRING
7 Creating REST services
8 Securing REST
9 Sending messages asynchronously
10 Integrating Spring
PART 3 REACTIVE SPRING
11 Introducing Reactor
12 Developing reactive APIs
13 Persisting data reactively
14 Working with RSocket
PART 4 DEPLOYED SPRING
15 Working with Spring Boot Actuator
16 Administering Spring
17 Monitoring Spring with JMX
18 Deploying Spring
In Spring in Action, 6th Edition you will learn:
Building reactive applications
Relational and NoSQL databases
Integrating via HTTP and REST-based services, and sand reactive RSocket services
Reactive programming techniques
Deploying applications to traditional servers and containers
Securing applications with Spring Security
Over the years, Spring in Action has helped tens of thousands of developers get a major productivity boost from Spring. This new edition of the classic bestseller covers all of the new features of Spring 5.3 and Spring Boot 2.4 along with examples of reactive programming, Spring Security for REST Services, and bringing reactivity to your databases. You'll also find the latest Spring best practices, including Spring Boot for application setup and configuration.
About the technology
Spring is required knowledge for Java developers! Why? Th is powerful framework eliminates a lot of the tedious configuration and repetitive coding tasks, making it easy to build enterprise-ready, production-quality software. The latest updates bring huge productivity boosts to microservices, reactive development, and other modern application designs. It’s no wonder over half of all Java developers use Spring.
About the book
Spring in Action, Sixth Edition is a comprehensive guide to Spring’s core features, all explained in Craig Walls’ famously clear style. You’ll put Spring into action as you build a complete database-backed web app step-by-step. This new edition covers both Spring fundamentals and new features such as reactive flows, Kubernetes integration, and RSocket. Whether you’re new to Spring or leveling up to Spring 5.3, make this classic bestseller your bible!
What's inside
Relational and NoSQL databases
Integrating via RSocket and REST-based services
Reactive programming techniques
Deploying applications to traditional servers and containers
About the reader
For beginning to intermediate Java developers.
About the author
Craig Walls is an engineer at VMware, a member of the Spring engineering team, a popular author, and a frequent conference speaker.
Table of Contents
PART 1 FOUNDATIONAL SPRING
1 Getting started with Spring
2 Developing web applications
3 Working with data
4 Working with nonrelational data
5 Securing Spring
6 Working with configuration properties
PART 2 INTEGRATED SPRING
7 Creating REST services
8 Securing REST
9 Sending messages asynchronously
10 Integrating Spring
PART 3 REACTIVE SPRING
11 Introducing Reactor
12 Developing reactive APIs
13 Persisting data reactively
14 Working with RSocket
PART 4 DEPLOYED SPRING
15 Working with Spring Boot Actuator
16 Administering Spring
17 Monitoring Spring with JMX
18 Deploying Spring
Frequently asked questions
Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weâve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere â even offline. Perfect for commutes or when youâre on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Spring in Action, Sixth Edition by Craig Walls in PDF and/or ePUB format, as well as other popular books in Computer Science & Databases. We have over one million books available in our catalogue for you to explore.
Information
Part 1. Foundational Spring
Part 1 of this book will get you started writing a Spring application, learning the foundations of Spring along the way.
In chapter 1, Iâll give you a quick overview of Spring and Spring Boot essentials and show you how to initialize a Spring project as you work on building Taco Cloud, your first Spring application. In chapter 2, youâll dig deeper into the Spring MVC and learn how to present model data in the browser and how to process and validate form input. Youâll also get some tips on choosing a view template library. Youâll add data persistence to the Taco Cloud application in chapter 3, where weâll cover using Springâs JDBC template and how to insert data using prepared statements and key holders. Then youâll see how to declare JDBC (Java Database Connectivity) and JPA (Java Persistence API) repositories with Spring Data. Chapter 4 continues the Spring persistence story by looking at two more Spring Data modules for persisting data to Cassandra and MongoDB. Chapter 5 covers security for your Spring application, including autoconfiguring Spring Security, defining custom user storage, customizing the login page, and securing against cross-site request forgery attacks. To close out part 1, weâll look at configuration properties in chapter 6. Youâll learn how to fine-tune autoconfigured beans, apply configuration properties to application components, and work with Spring profiles.
1 Getting started with Spring
This chapter covers
- Spring and Spring Boot essentials
- Initializing a Spring project
- An overview of the Spring landscape
Although the Greek philosopher Heraclitus wasnât well known as a software developer, he seems to have had a good handle on the subject. He has been quoted as saying, âThe only constant is change.â That statement captures a foundational truth of software development.
The way we develop applications today is different than it was a year ago, 5 years ago, 10 years ago, and certainly 20 years ago, before an initial form of the Spring Framework was introduced in Rod Johnsonâs book, Expert One-on-One J2EE Design and Development (Wrox, 2002, http://mng.bz/oVjy).
Back then, the most common types of applications developed were browser-based web applications, backed by relational databases. Although that type of development is still relevantâand Spring is well equipped for those kinds of applicationsâweâre now also interested in developing applications composed of microservices destined for the cloud that persist data in a variety of databases. And a new interest in reactive programming aims to provide greater scalability and improved performance with nonblocking operations.
As software development evolved, the Spring Framework also changed to address modern development concerns, including microservices and reactive programming. The creators of Spring also set out to simplify its development model by introducing Spring Boot.
Whether youâre developing a simple database-backed web application or constructing a modern application built around microservices, Spring is the framework that will help you achieve your goals. This chapter is your first step in a journey through modern application development with Spring.
1.1 What is Spring?
I know youâre probably itching to start writing a Spring application, and I assure you that before this chapter ends, youâll have developed a simple one. But first, let me set the stage with a few basic Spring concepts that will help you understand what makes Spring tick.
Any nontrivial application comprises many components, each responsible for its own piece of the overall application functionality, coordinating with the other application elements to get the job done. When the application is run, those components somehow need to be created and introduced to each other.
At its core, Spring offers a container, often referred to as the Spring application context, that creates and manages application components. These components, or beans, are wired together inside the Spring application context to make a complete application, much like bricks, mortar, timber, nails, plumbing, and wiring are bound together to make a house.
The act of wiring beans together is based on a pattern known as dependency injection (DI). Rather than have components create and maintain the life cycle of other beans that they depend on, a dependency-injected application relies on a separate entity (the container) to create and maintain all components and inject those into the beans that need them. This is done typically through constructor arguments or property accessor methods.
For example, suppose that among an applicationâs many components, you will address two: an inventory service (for fetching inventory levels) and a product service (for providing basic product information). The product service depends on the inventory service to be able to provide a complete set of information about products. Figure 1.1 illustrates the relationships between these beans and the Spring application context.
On top of its core container, Spring and a full portfolio of related libraries offer a web framework, a variety of data persistence options, a security framework, integration with other systems, runtime monitoring, microservice support, a reactive programming model, and many other features necessary for modern application development.
Historically, the way you would guide Springâs application context to wire beans together was with one or more XML files that described the components and their relationship to other components.

Figure 1.1 Application components are managed and injected into each other by the Spring application context.
For example, the following XML code declares two beans, an
InventoryService bean and a ProductService bean, and wires the InventoryService bean into ProductService via a constructor argument:<bean id="inventoryService" class="com.example.InventoryService" /> <bean id="productService" class="com.example.ProductService" /> <constructor-arg ref="inventoryService" /> </bean>
In recent versions of Spring, however, a Java-based configuration is more common. The following Java-based configuration class is equivalent to the XML configuration:
@Configuration public class ServiceConfiguration { @Bean public InventoryService inventoryService() { return new InventoryService(); } @Bean public ProductService productService() { return new ProductService(inventoryService()); } } The
@Configuration annotation indicates to Spring that this is a configuration class that will provide beans to the Spring application context.The configurationâs methods are annotated with
@Bean, indicating that the objects they return should be added as beans in the application context (where, by default, their respective bean IDs will be the same as the names of the methods that define them).Java-based configuration offers several benefits over XML-based configuration, including greater type safety and improved refactorability. Even so, explicit configuration with either Java or XML is necessary only if Spring is unable to automatically configure the components.
Automatic configuration has its roots in the Spring techniques known as autowiring and component scanning. With compo...
Table of contents
- Spring in Action
- Copyright
- From the fifth edition of Spring in Action by Craig Walls
- brief contents
- contents
- front matter
- Part 1. Foundational Spring
- 1 Getting started with Spring
- 2 Developing web applications
- 3 Working with data
- 4 Working with nonrelational data
- 5 Securing Spring
- 6 Working with configuration properties
- Part 2. Integrated Spring
- 7 Creating REST services
- 8 Securing REST
- 9 Sending messages asynchronously
- 10 Integrating Spring
- Part 3. Reactive Spring
- 11 Introducing Reactor
- 12 Developing reactive APIs
- 13 Persisting data reactively
- 14 Working with RSocket
- Part 4. Deployed Spring
- 15 Working with Spring Boot Actuator
- 16 Administering Spring
- 17 Monitoring Spring with JMX
- 18 Deploying Spring
- Appendix. Bootstrapping Spring applications
- index