Book description
A developer's guide to designing, testing, and securing production-ready modern APIs with the help of practical ideas to improve your application's functionality
Key Features
- Build resilient software for your enterprises and customers by understanding the complete API development life cycle
- Overcome the challenges of traditional API design by adapting to a new and evolving culture of modern API development
- Use Spring and Spring Boot to develop future-proof scalable APIs
Book Description
The philosophy of API development has evolved over the years to serve the modern needs of enterprise architecture, and developers need to know how to adapt to these modern API design principles. Apps are now developed with APIs that enable ease of integration for the cloud environment and distributed systems. With this Spring book, you'll discover various kinds of production-ready API implementation using REST APIs and explore async using the reactive paradigm, gRPC, and GraphQL.
You'll learn how to design evolving REST-based APIs supported by HATEOAS and ETAGs and develop reactive, async, non-blocking APIs. After that, you'll see how to secure REST APIs using Spring Security and find out how the APIs that you develop are consumed by the app's UI. The book then takes you through the process of testing, deploying, logging, and monitoring your APIs. You'll also explore API development using gRPC and GraphQL and design modern scalable architecture with microservices. The book helps you gain practical knowledge of modern API implementation using a sample e-commerce app.
By the end of this Spring book, you'll be able to develop, test, and deploy highly scalable, maintainable, and developer-friendly APIs to help your customers to transform their business.
What you will learn
- Understand RESTful API development, its design paradigm, and its best practices
- Become well versed in Spring's core components for implementing RESTful web services
- Implement reactive APIs and explore async API development
- Apply Spring Security for authentication using JWT and authorization of requests
- Develop a React-based UI to consume APIs
- Implement gRPC inter-service communication
- Design GraphQL-based APIs by understanding workflows and tooling
- Gain insights into how you can secure, test, monitor, and deploy your APIs
Who this book is for
This book is for inexperienced Java programmers, comp science, or coding boot camp graduates who have knowledge of basic programming constructs, data structures, and algorithms in Java but lack the practical web development skills necessary to start working as a developer. Professionals who've recently joined a startup or a company and are tasked with creating real-world web APIs and services will also find this book helpful. This book is also a good resource for Java developers who are looking for a career move into web development to get started with the basics of web service development.
Table of contents
- Modern API Development with Spring and Spring Boot
- Contributors
- About the author
- About the reviewer
- Preface
- Section 1: RESTful Web Services
- Chapter 1: RESTful Web Service Fundamentals
- Chapter 2: Spring Concepts and REST APIs
-
Chapter 3: API Specifications and Implementation
- Technical requirements
- Designing APIs with OAS
-
Converting OAS to Spring code
- Step 1 – adding the Gradle plugin
- Step 2 – defining the OpenAPI config for code generation
- Step 3 – defining the OpenAPI Generator ignore file
- Step 4 – defining a swaggerSources task in the Gradle build file
- Step 5 – adding swaggerSources to the compileJava task dependency
- Step 6 – adding the generated source code to Gradle sourceSets
- Step 7 – running the build for generating, compiling, and building the code
- Implementing the OAS code interfaces
- Adding a Global Exception Handler
- Summary
- Questions
- Further reading
- Chapter 4: Writing Business Logic for APIs
-
Chapter 5: Asynchronous API Design
- Technical requirements
- Understanding Reactive Streams
- Exploring Spring WebFlux
- Understanding DispatcherHandler
-
Implementing Reactive APIs for our e-commerce app
- Changing OpenAPI Codegen for Reactive APIs
- Adding Reactive dependencies in build.xml
- Handling exceptions
- Adding hypermedia links to an API response
- Defining an entity
- Adding repositories
- Adding services
- Adding controller implementations
- Adding H2 Console to an application
- Adding application configuration
- Testing Reactive APIs
- Summary
- Questions
- Further reading
- Section 2: Security, UI, Testing, and Deployment
- Chapter 6: Security (Authorization and Authentication)
- Chapter 7: Designing a User Interface
- Chapter 8: Testing APIs
- Chapter 9: Deployment of Web Services
- Section 3: gRPC, Logging, and Monitoring
- Chapter 10: gRPC Fundamentals
- Chapter 11: gRPC-based API Development and Testing
- Chapter 12: Logging and Tracing
- Section 4: GraphQL
- Chapter 13: GraphQL Fundamentals
- Chapter 14: GraphQL API Development and Testing
-
Assessments
- Chapter 1 – RESTful Web Services Fundamentals
- Chapter 2 – Spring Concepts and REST APIs
- Chapter 3 – API Specifications and Implementation
- Chapter 4 – Writing Business Logic for APIs
- Chapter 5 – Asynchronous API Design
- Chapter 6 – Security (Authorization and Authentication)
- Chapter 7 – Designing the User Interface
- Chapter 8 – Testing APIs
- Chapter 9 – Deployment of Web Services
- Chapter 10 – gRPC Fundamentals
- Chapter 11 – gRPC-Based API Development and Testing
- Chapter 12 – Logging and Tracing
- Chapter 13 – GraphQL Fundamentals
- Chapter 14 – GraphQL API Development and Testing
- Why subscribe?
- Other Books You May Enjoy
Product information
- Title: Modern API Development with Spring and Spring Boot
- Author(s):
- Release date: June 2021
- Publisher(s): Packt Publishing
- ISBN: 9781800562479
You might also like
book
Beginning Spring Boot 2: Applications and Microservices with the Spring Framework
Learn Spring Boot and how to build Java-based enterprise, web, and microservice applications with it. In …
video
Modern Java Web Applications with Spring Boot 2.x
Building web application has been a challenge for many Java developers because of the complexities of …
video
Full-Stack React with Spring Boot
11 Hours of Video Instruction Build full-stack applications using React and Spring Boot. Overview: In recent …
book
Beginning Spring Boot 3: Build Dynamic Cloud-Native Java Applications and Microservices
Learn the Spring Boot 3 micro framework and build your first Java-based cloud-native applications and microservices. …