1 option
Modern API Development with Spring 6 and Spring Boot 3 : Design Scalable, Viable, and Reactive APIs with REST, GRPC, and GraphQL Using Java 17 and Spring Boot 3 / Sourabh Sharma.
- Format:
- Book
- Author/Creator:
- Sharma, Sourabh, author.
- Language:
- English
- Subjects (All):
- Application software.
- Object-oriented programming languages.
- Java (Computer program language).
- Programming languages (Electronic computers).
- Physical Description:
- 1 online resource (494 pages)
- Edition:
- Second edition.
- Place of Publication:
- Birmingham, England : Packt Publishing Ltd., [2021]
- Biography/History:
- Sharma Sourabh: Sourabh Sharma works at Oracle as a lead technical member where he is responsible for developing and designing the key components of the blueprint solutions that are used by various Oracle products. He has over 18 years of experience delivering enterprise products and applications for leading companies. His expertise lies in conceptualizing, modeling, designing, and developing N-tier and cloud-based web applications as well as leading teams. He has vast experience in developing microservice-based solutions and implementing various types of workflow and orchestration engines. Sourabh believes in continuous learning and sharing knowledge through his books and training.
- Summary:
- Spring is a powerful and widely adopted framework for building scalable and reliable web applications in Java, complemented by Spring Boot, a popular extension to the framework that simplifies the setup and configuration of Spring-based applications. This book is an in-depth guide to harnessing Spring 6 and Spring Boot 3 for web development, offering practical knowledge of building modern robust web APIs and services. The book covers a wide range of topics that are essential for API development, including RESTful web service fundamentals, Spring concepts, and API specifications. It also explores asynchronous API design, security, designing user interfaces, testing APIs, and the deployment of web services. In addition to its comprehensive coverage, this book offers a highly contextual real-world sample app that you can use as a reference for building different types of APIs for real-world applications. This sample app will lead you through the entire API development cycle, encompassing design and specification, implementation, testing, and deployment. By the end of this book, you’ll have learned how to design, develop, test, and deploy scalable and maintainable modern APIs using Spring 6 and Spring Boot 3, along with best practices for bolstering the security and reliability of your applications and improving your application's overall functionality. This book is for novice Java programmers, computer science graduates, coding boot camp alumni, and newcomers to the realm of creating real-world web APIs and services. It is an invaluable resource for Java developers transitioning to web development, offering an all-encompassing introduction to web service development. If you possess knowledge of fundamental programming constructs, data structures, and algorithms in Java but lack practical web development experience, this book will serve as a bridge to cultivate the essential skills for entry into the role of a web developer.
- Contents:
- Cover
- Title Page
- Copyright and credits
- Contributors
- Table of Contents
- Preface
- Part 1 - RESTful Web Services
- Chapter 1: RESTful Web Service Fundamentals
- Technical requirements
- Introducing REST APIs
- The history of REST
- REST fundamentals
- Handling resources and URIs
- The URI syntax
- What is a URL?
- What is a URN?
- Exploring HTTP methods and status codes
- POST
- GET
- PUT
- DELETE
- PATCH
- HTTP status codes
- What is HATEOAS?
- Best practices for designing REST APIs
- Using nouns and not verbs when naming a resource in the endpoint path
- Using the plural form for naming the collection resource in the endpoint path
- Using hypermedia (HATEOAS)
- Versioning your APIs
- Nesting resources
- Securing APIs
- Maintaining documentation
- Complying with recommended status codes
- Ensuring caching
- Maintaining the rate limit
- Introducing our e-commerce app
- Summary
- Questions
- Answers
- Further reading
- Chapter 2: Spring Concepts and REST APIs
- Understanding the patterns and paradigms of Spring
- What is IoC?
- What is DI?
- What is AOP?
- Understanding the application of IoC containers
- Defining a bean and its scope
- The @ComponentScan annotation
- The bean's scope
- Configuring beans using Java
- The @Import annotation
- The @DependsOn annotation
- How to code DI
- Using a constructor to define a dependency
- Using a setter method to define a dependency
- Using a class property to define a dependency
- Configuring a bean's metadata using annotations
- How to use @Autowired?
- Matching by type
- Matching by qualifier
- Matching by name
- What is the purpose of @Primary?
- When can we use @Value?
- Writing code for AOP
- Why use Spring Boot?
- Understanding the importance of servlet dispatcher
- Answers.
- Further reading
- Chapter 3: API Specifications and Implementation
- Designing APIs with OAS
- Understanding the basic structure of OAS
- The metadata sections of OAS
- The servers and tags sections of OAS
- The components section of OAS
- The path section of OAS
- Converting OAS to Spring code
- Implementing the OAS code interfaces
- Adding a Global Exception Handler
- Testing the implementation of the API
- Chapter 4: Writing Business Logic for APIs
- Overview of the service design
- Adding a Repository component
- The @Repository annotation
- Configuring the database and JPA
- The database and seed data script
- Adding entities
- Adding repositories
- Adding a Service component
- Implementing hypermedia
- Enhancing the controller with a service and HATEOAS
- Adding ETags to API responses
- Testing the APIs
- Chapter 5: Asynchronous API Design
- Understanding Reactive Streams
- Publisher
- Subscriber
- Subscription
- Processor
- Exploring Spring WebFlux
- Understanding reactive APIs
- Reactive Core
- Understanding DispatcherHandler
- Controllers
- Functional endpoints
- Implementing reactive APIs for our e-commerce app
- Changing OpenAPI Codegen for reactive APIs
- Adding Reactive dependencies to build.xml
- Handling exceptions
- Handling global exceptions for controllers
- Adding hypermedia links to an API response
- Defining an entity
- Adding services
- Adding controller implementations
- Adding H2 Console to an application
- Adding application configuration
- Testing reactive APIs
- Part 2 - Security, UI, Testing, and Deployment.
- Chapter 6: Securing REST Endpoints Using Authorization and Authentication
- Implementing authentication using Spring Security and JWT
- Adding the required Gradle dependencies
- Authentication using the OAuth 2.0 resource server
- Exploring the structure of JWT
- Securing REST APIs with JWT
- Adding new APIs
- Implementing the JWT manager
- Implementing new APIs
- Implementing the REST controllers
- Configuring web-based security
- Configuring CORS and CSRF
- Understanding authorization
- Role and authority
- Testing security
- Chapter 7: Designing a User Interface
- Learning React fundamentals
- Creating a React app
- Exploring the basic structures and files
- Understanding the package.json file
- Bootstrapping a React app
- Exploring React components and other features
- Exploring JSX
- Understanding React hooks
- Styling components using Tailwind
- Designing the e-commerce app components
- Consuming APIs using Fetch
- Writing the product API client
- Coding the Product Listing page
- Why does the cart need to be fetched in ProductList?
- Configuring routing
- Developing the ProductCard component
- Developing the ProductDetail component
- Implementing authentication
- Creating a custom useToken hook
- Writing the Login component
- Writing the custom cart context
- Writing the Cart component
- Writing the Order component
- Writing the root (App) component
- Running the application
- Chapter 8: Testing APIs
- Testing APIs and code manually
- Testing automation
- Unit testing
- Testing exceptions
- Executing unit tests
- Code coverage
- Integration testing
- Further reading.
- Chapter 9: Deployment of Web Services
- What is containerization?
- Building a Docker image
- What is Docker?
- Understanding Docker's architecture
- Docker container life cycle
- Coding to build an image by adding the Actuator dependency
- Configuring the Spring Boot plugin task
- Configuring the Docker registry
- Executing a Gradle task to build an image
- Deploying an application in Kubernetes
- Part 3 - gRPC, Logging, and Monitoring
- Chapter 10: Getting Started with gRPC
- How does gRPC work?
- REST versus gRPC
- Can I call the gRPC server from web browsers and mobile apps?
- Getting to know the gRPC architecture
- How gRPC uses Protobuf
- Understanding service definitions
- Exploring the RPC life cycle
- Events that impact the life cycle
- Understanding the gRPC server and gRPC stub
- Handling errors and error status codes
- Chapter 11: gRPC API Development and Testing
- Writing an API
- Setting up the project
- Writing the payment gateway functionalities
- Developing the gRPC server
- Implementation of the gRPC server
- Implementation of the gRPC server class
- Testing the gRPC server
- Coding for handling errors
- Developing the gRPC client
- Implementing the gRPC client
- Testing the gRPC service
- Understanding microservice concepts
- Traditional monolithic design
- Monolithic design with services
- Microservices design
- Chapter 12: Adding Logging and Tracing to Services
- Logging and tracing using the ELK stack
- Understanding the ELK stack
- Installing the ELK stack
- Implementing logging and tracing in the gRPC code.
- Changing the gRPC server code
- Changing the gRPC client code
- Testing the logging and tracing changes
- Distributed tracing with Zipkin and Micrometer
- Part 4 - GraphQL
- Chapter 13: Getting Started with GraphQL
- Getting to know GraphQL
- A brief history of GraphQL
- Comparing GraphQL with REST
- Learning the fundamentals of GraphQL
- Exploring the Query type
- Exploring the Mutation type
- Exploring the Subscription type
- Designing a GraphQL schema
- Understanding scalar types
- Understanding fragments
- Understanding interfaces
- Understanding Union types
- Understanding input types
- Designing a schema with GraphQL tools
- Testing GraphQL queries and mutations
- Solving the N+1 problem
- What is the N+1 problem?
- How can we solve the N+1 problem?
- Chapter 14: GraphQL API Development and Testing
- Workflow and tooling for GraphQL
- Implementing the GraphQL server
- Creating the gRPC server project
- Adding the GraphQL DGS dependencies
- Adding the GraphQL schema
- Adding custom scalar types
- Documenting APIs
- Implementing GraphQL queries
- Writing fetchers for GraphQL queries
- Writing the data fetcher for product
- Writing the data fetcher for a collection of products
- Writing the field resolver using the data fetcher method
- Writing a data loader for solving the N+1 problem
- Implementing GraphQL mutations
- Implementing and testing GraphQL subscriptions
- Understanding the WebSocket sub-protocol for GraphQL
- Testing GraphQL subscriptions using Insomnia WebSocket
- Instrumenting the GraphQL APIs
- Adding a custom header
- Integration with Micrometer
- Test automation
- Testing GraphQL queries
- Testing GraphQL mutations.
- Testing GraphQL subscriptions using automated test code.
- Notes:
- Includes index.
- Description based on print version record.
- ISBN:
- 9781803244563
- 1803244569
- OCLC:
- 1401632282
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.