With over 75 million downloads per month, Spring Boot is the most widely used Java framework available. Its ease and power have revolutionized application development from monoliths to microservices. Yet Spring Boot's simplicity can also be confounding. How do developers learn enough to be productive immediately? This practical book shows you how to use this framework to write successful mission-critical applications.
Mark Heckler from VMware, the company behind Spring, guides you through Spring Boot's architecture and approach, covering topics such as debugging, testing, and deployment. If you want to develop cloud native Java or Kotlin applications with Spring Boot rapidly and effectively (using reactive programming, building APIs, and creating database access of all kinds) this book is for you.
• Learn how Spring Boot simplifies cloud native application development and deployment
• Build reactive applications and extend communication across the network boundary to create distributed systems
• Understand how Spring Boot's architecture and approach increase developer productivity and application portability
• Deploy Spring Boot applications for production workloads rapidly and reliably
• Monitor application and system health for optimal performance and reliability
• Debug, test, and secure cloud-based applications painlessly
With over 75 million downloads per month, Spring Boot is the most widely used Java framework available. Its ease and power have revolutionized application development from monoliths to microservices. Yet Spring Boot's simplicity can also be confounding. How do developers learn enough to be productive immediately? This practical book shows you how to use this framework to write successful mission-critical applications.
Mark Heckler from VMware, the company behind Spring, guides you through Spring Boot's architecture and approach, covering topics such as debugging, testing, and deployment. If you want to develop cloud native Java or Kotlin applications with Spring Boot rapidly and effectively (using reactive programming, building APIs, and creating database access of all kinds) this book is for you.
- Learn how Spring Boot simplifies cloud native application development and deployment
- Build reactive applications and extend communication across the network boundary to create distributed systems
- Understand how Spring Boot's architecture and approach increase developer productivity and application portability
- Deploy Spring Boot applications for production workloads rapidly and reliably
- Monitor application and system health for optimal performance and reliability
- Debug, test, and secure cloud-based applications painlessly
Author(s): Mark Heckler
Edition: 1
Publisher: O'Reilly Media
Year: 2021
Language: English
Commentary: Vector PDF
Pages: 328
City: Sebastopol, CA
Tags: Debugging; Java; Monitoring; Reactive Programming; Application Development; Unit Testing; Spring Framework; Kotlin; Model-View-Controller Pattern; Gradle; REST API; Maven; Database Access
Copyright
Table of Contents
Preface
Welcome
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Chapter 1. Spring Boot in a Nutshell
Spring Boot’s Three Foundational Features
Starters for Simplified Dependency Management
Executable JARs for Simplified Deployment
Autoconfiguration
Summary
Chapter 2. Choosing Your Tools and Getting Started
Maven or Gradle?
Apache Maven
Gradle
Choosing Between Maven and Gradle
Java or Kotlin?
Java
Kotlin
Choosing Between Java and Kotlin
Choosing a Version of Spring Boot
The Spring Initializr
Straight Outta Commandline
Staying In Integrated Development Environments (IDEs)
Cruising Down main()
Summary
Chapter 3. Creating Your First Spring Boot REST API
The Hows and Whys of APIs
What Is REST, and Why Does It Matter?
Your API, HTTP Verb Style
Back to the Initializr
Creating a Simple Domain
GET-ting
@RestController in a Nutshell
POST-ing
PUT-ting
DELETE-ing
And More
Trust, but Verify
Summary
Chapter 4. Adding Database Access to Your Spring Boot App
Priming Autoconfig for Database Access
What Do We Hope to Gain?
Adding a Database Dependency
Adding Code
Saving and Retrieving Data
A Bit of Polishing
Summary
Chapter 5. Configuring and Inspecting Your Spring Boot App
Application Configuration
@Value
@ConfigurationProperties
Potential Third-Party Option
Autoconfiguration Report
Actuator
Getting Actuator to Open Up
Becoming More Environmentally Aware Using Actuator
Turning Up the Volume on Logging with Actuator
Summary
Chapter 6. Really Digging into Data
Defining Entities
Template Support
Repository Support
@Before
Creating a Template-Based Service Using Redis
Initializing the Project
Developing the Redis Service
Converting from Template to Repository
Creating a Repository-Based Service Using the Java Persistence API (JPA)
Initializing the Project
Developing the JPA (MySQL) Service
Loading Data
Creating a Repository-Based Service Using a NoSQL Document Database
Initializing the Project
Developing the MongoDB Service
Creating a Repository-Based Service Using a NoSQL Graph Database
Initializing the Project
Developing the Neo4j Service
Summary
Chapter 7. Creating Applications Using Spring MVC
Spring MVC: What Does It Mean?
End User Interactions Using Template Engines
Initializing the Project
Developing the Aircraft Positions Application
Passing Messages
Powering Up PlaneFinder
Extending the Aircraft Positions Application
Creating Conversations with WebSocket
What Is WebSocket?
Refactoring the Aircraft Positions Application
Summary
Chapter 8. Reactive Programming with Project Reactor and Spring WebFlux
Introduction to Reactive Programming
Project Reactor
Tomcat versus Netty
Reactive Data Access
R2DBC with H2
Reactive Thymeleaf
RSocket for Fully Reactive Interprocess Communication
What Is RSocket?
Putting RSocket to Work
Summary
Chapter 9. Testing Spring Boot Applications for Increased Production Readiness
Unit Testing
Introducing @SpringBootTest
Important Unit Tests for the Aircraft Positions Application
Refactoring for Better Testing
Testing Slices
Summary
Chapter 10. Securing Your Spring Boot Application
Authentication and Authorization
Authentication
Authorization
Spring Security in a Nutshell
The HTTP Firewall
Security Filter Chains
Request and Response Headers
Implementing Forms-Based Authentication and Authorization with Spring Security
Adding Spring Security Dependencies
Adding Authentication
Authorization
Implementing OpenID Connect and OAuth2 for Authentication and Authorization
Aircraft Positions Client Application
PlaneFinder Resource Server
Summary
Chapter 11. Deploying Your Spring Boot Application
Revisiting the Spring Boot Executable JAR
Building a “Fully Executable” Spring Boot JAR
What Does It Mean?
Exploding JARs
Deploying Spring Boot Applications to Containers
Creating a Container Image from an IDE
Creating a Container Image from the Command Line
Verifying the Image Exists
Running the Containerized Application
Utilities for Examining Spring Boot Application Container Images
Pack
Dive
Summary
Chapter 12. Going Deeper with Reactive
When Reactive?
Testing Reactive Applications
But First, Refactoring
And Now, the Testing
Diagnosing and Debugging Reactive Applications
Hooks.onOperatorDebug()
Checkpoints
ReactorDebugAgent.init()
Summary
Index
About the Author
Colophon