Spring 5.0 Cookbook

Over 100 hands-on recipes to build web applications easily and efficiently IN Spring 5.0
Preview in Mapt

Spring 5.0 Cookbook

Sherwin John Calleja Tragura

Over 100 hands-on recipes to build web applications easily and efficiently IN Spring 5.0

Quick links: > What will you learn?> Table of content

eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$28.00
$49.99
RRP $39.99
RRP $49.99
eBook
Print + eBook

Frequently bought together


Spring 5.0 Cookbook Book Cover
Spring 5.0 Cookbook
$ 39.99
$ 28.00
Spring 5 Design Patterns Book Cover
Spring 5 Design Patterns
$ 35.99
$ 25.20
Buy 2 for $35.00
Save $40.98
Add to Cart

Book Details

ISBN 139781787128316
Paperback670 pages

Book Description

The Spring framework has been the go-to framework for Java developers for quite some time. It enhances modularity, provides more readable code, and enables the developer to focus on developing the application while the underlying framework takes care of transaction APIs, remote APIs, JMX APIs, and JMS APIs.

The upcoming version of the Spring Framework has a lot to offer, above and beyond the platform upgrade to Java 9, and this book will show you all you need to know to overcome common to advanced problems you might face.

Each recipe will showcase some old and new issues and solutions, right from configuring Spring 5.0 container to testing its components. Most importantly, the book will highlight concurrent processes, asynchronous MVC and reactive programming using Reactor Core APIs. Aside from the core components, this book will also include integration of third-party technologies that are mostly needed in building enterprise applications.

By the end of the book, the reader will not only be well versed with the essential concepts of Spring, but will also have mastered its latest features in a solution-oriented manner.

Table of Contents

Chapter 1: Getting Started with Spring
Installing Java Development Kit 1.8
Installing Tomcat 9 and configuring HTTP/2
Installing STS Eclipse 3.8 IDE
Creating Eclipse projects using Maven
Creating Spring STS Eclipse projects using Gradle
Deploying Spring projects using Maven
Deploying Spring projects using Gradle
Installing the MySQL 5.7 database server
Installing the MongoDB 3.2 database server
Chapter 2: Learning Dependency Injection (DI)
Implementing a Spring container using XML
Implementing a Spring container using JavaConfig
Managing beans in an XML-based container
Managing beans in the JavaConfig container
Creating Singleton and Prototype beans
Defining eager and lazy spring beans
Creating an inner bean
Injecting Collections and Properties
Creating a Spring MVC using an XML-based approach
Creating a Spring MVC using the JavaConfig approach
Generating multiple ApplicationContexts
Using ResourceBundleMessageSource for Views
Chapter 3: Implementing MVC Design Patterns
Creating the simple @Controller
Creating a simple @Controller with method-level URL mapping
Designing a simple form @Controller
Creating a multi-action @Controller
Form validation and parameter type conversion
Creating request- and session-scoped beans
Implementing page redirection and Flash-scoped beans
Creating database connection pooling
Implementing the DAO layer using the Spring JDBC Framework
Creating a service layer in an MVC application
Chapter 4: Securing Spring MVC Applications
Configuring Spring Security 4.2.2
Mapping sessions to channels and ports
Customizing the authentication process
Implementing authentication filters, login success, and failure handlers
Creating user details
Generating encrypted passwords
Applying Security to MVC methods
Creating roles and permissions from the database
Managing and storing sessions
Solving Cross-Site Request Forgery (CSRF) and session fixation attacks
Solving Cross-Site Scripting (XSS) and clickjacking attacks
Creating interceptors for login data validation
Chapter 5: Cross-Cutting the MVC
Logging and auditing service methods
Managing DAO transactions
Monitoring services and request handlers
Validating parameters and arguments
Managing exceptions
Implementing the caching mechanism
Intercepting request transactions
Implementing user authentication
Accessing with restrictions
Controlling concurrent user access
Implementing a mini-workflow using AOP
Chapter 6: Functional Programming
Implementing lambda expressions using anonymous inner classes
Implementing lambda expression using @FunctionInterface
Applying the built-in functional interfaces
Applying method and constructor references
Using the Stream API
Applying streams to collections
Applying streams to NIO 2.0
Using parallel streams
Chapter 7: Reactive Programming
Applying the observer design pattern using Reactive Streams
Creating Mono<T> and Flux<T> publishers
Implementing the Subscriber<T> interface
Applying backpressure to Mono<T> and Flux<T>
Managing task executions using Schedulers
Creating concurrent and parallel emissions
Managing continuous data emission
Implementing Stream manipulation and transformation
Testing Reactive data transactions
Implementing Reactive events using RxJava 2.x
Chapter 8: Reactive Web Applications
Configuring the TaskExecutor
Implementing @Async services
Creating asynchronous controllers
Creating @Scheduled services
Using Future<T> and CallableFuture<T>
Using Mono<T> and Flux<T> publishers for services
Creating Mono<T> and Flux<T> HTTP response
Integrating RxJava 2.0
Using FreeMarker to render Publisher<T> stream
Using Thymeleaf to render a Publisher<T> stream
Applying security on TaskExecutors
Chapter 9: Spring Boot 2.0
Building a non-reactive Spring MVC application
Configuring Logging
Adding JDBC Connectivity
Building a reactive Spring MVC application
Configuring Spring Security 5.x
Using reactive view resolvers
Using RouterFunction and HandlerFunction
Implementing Spring Data with JPA
Implementing REST services using @RestController and Spring REST
Applying Spring Cache
Chapter 10: The Microservices
Exposing RESTful services in Spring 5
Using the actuator REST endpoints
Building a client-side application with RestTemplate, AsyncRestTemplate and, WebClient
Configuring the Eureka server for service registration
Implementing the Eureka service discovery and client-side load balancing
Applying resiliency to client applications
Consuming endpoints using a declarative method
Using Docker for deployment
Chapter 11: Batch and Message-Driven Processes
Building synchronous batch processes
Implementing batch processes with a database
Constructing asynchronous batch processes
Building synchronous interprocess communication using AMQP
Creating asynchronous send-receive communication
Creating an event-driven asynchronous communication using AMQP
Creating stream communication with Spring Cloud Stream
Implementing batch processes using Spring Cloud Task
Chapter 12: Other Spring 5 Features
Using Hibernate 5 object-relational mapping
Applying Hazelcast distributed caching
Building client-server communications with WebSocket
Implementing Reactive WebSocket communication
Implementing asynchronous Spring Data JPA properties
Implementing Reactive Spring Data JPA repositories
Using Spring Data MongoDB
Building applications for big data storage
Building a Spring 5 application using Kotlin
Chapter 13: Testing Spring 5 Components
Creating tests for Spring MVC components
Building standalone controller tests
Creating tests for DAO and service layers
Creating tests on secured applications
Creating tests using Spring Boot 2.0
Creating tests for Spring Data JPA
Building tests for blocking, asynchronous and reactive RESTful services
Building tests for Kotlin components

What You Will Learn

  • Understand how functional programming and concurrency in JDK 1.9 works, and how it will affect Spring 5.0
  • Learn the importance and application of reactive programming in creating services, and also the process of creating asynchronous MVC applications
  • Implement different Spring Data modules
  • Integrate Spring Security to the container
  • Create applications and deploy using Spring Boot
  • Conceptualize the architecture behind Microservices and learn the details of its implementation
  • Create different test cases for the components of Spring 5.0 components

Authors

Table of Contents

Chapter 1: Getting Started with Spring
Installing Java Development Kit 1.8
Installing Tomcat 9 and configuring HTTP/2
Installing STS Eclipse 3.8 IDE
Creating Eclipse projects using Maven
Creating Spring STS Eclipse projects using Gradle
Deploying Spring projects using Maven
Deploying Spring projects using Gradle
Installing the MySQL 5.7 database server
Installing the MongoDB 3.2 database server
Chapter 2: Learning Dependency Injection (DI)
Implementing a Spring container using XML
Implementing a Spring container using JavaConfig
Managing beans in an XML-based container
Managing beans in the JavaConfig container
Creating Singleton and Prototype beans
Defining eager and lazy spring beans
Creating an inner bean
Injecting Collections and Properties
Creating a Spring MVC using an XML-based approach
Creating a Spring MVC using the JavaConfig approach
Generating multiple ApplicationContexts
Using ResourceBundleMessageSource for Views
Chapter 3: Implementing MVC Design Patterns
Creating the simple @Controller
Creating a simple @Controller with method-level URL mapping
Designing a simple form @Controller
Creating a multi-action @Controller
Form validation and parameter type conversion
Creating request- and session-scoped beans
Implementing page redirection and Flash-scoped beans
Creating database connection pooling
Implementing the DAO layer using the Spring JDBC Framework
Creating a service layer in an MVC application
Chapter 4: Securing Spring MVC Applications
Configuring Spring Security 4.2.2
Mapping sessions to channels and ports
Customizing the authentication process
Implementing authentication filters, login success, and failure handlers
Creating user details
Generating encrypted passwords
Applying Security to MVC methods
Creating roles and permissions from the database
Managing and storing sessions
Solving Cross-Site Request Forgery (CSRF) and session fixation attacks
Solving Cross-Site Scripting (XSS) and clickjacking attacks
Creating interceptors for login data validation
Chapter 5: Cross-Cutting the MVC
Logging and auditing service methods
Managing DAO transactions
Monitoring services and request handlers
Validating parameters and arguments
Managing exceptions
Implementing the caching mechanism
Intercepting request transactions
Implementing user authentication
Accessing with restrictions
Controlling concurrent user access
Implementing a mini-workflow using AOP
Chapter 6: Functional Programming
Implementing lambda expressions using anonymous inner classes
Implementing lambda expression using @FunctionInterface
Applying the built-in functional interfaces
Applying method and constructor references
Using the Stream API
Applying streams to collections
Applying streams to NIO 2.0
Using parallel streams
Chapter 7: Reactive Programming
Applying the observer design pattern using Reactive Streams
Creating Mono<T> and Flux<T> publishers
Implementing the Subscriber<T> interface
Applying backpressure to Mono<T> and Flux<T>
Managing task executions using Schedulers
Creating concurrent and parallel emissions
Managing continuous data emission
Implementing Stream manipulation and transformation
Testing Reactive data transactions
Implementing Reactive events using RxJava 2.x
Chapter 8: Reactive Web Applications
Configuring the TaskExecutor
Implementing @Async services
Creating asynchronous controllers
Creating @Scheduled services
Using Future<T> and CallableFuture<T>
Using Mono<T> and Flux<T> publishers for services
Creating Mono<T> and Flux<T> HTTP response
Integrating RxJava 2.0
Using FreeMarker to render Publisher<T> stream
Using Thymeleaf to render a Publisher<T> stream
Applying security on TaskExecutors
Chapter 9: Spring Boot 2.0
Building a non-reactive Spring MVC application
Configuring Logging
Adding JDBC Connectivity
Building a reactive Spring MVC application
Configuring Spring Security 5.x
Using reactive view resolvers
Using RouterFunction and HandlerFunction
Implementing Spring Data with JPA
Implementing REST services using @RestController and Spring REST
Applying Spring Cache
Chapter 10: The Microservices
Exposing RESTful services in Spring 5
Using the actuator REST endpoints
Building a client-side application with RestTemplate, AsyncRestTemplate and, WebClient
Configuring the Eureka server for service registration
Implementing the Eureka service discovery and client-side load balancing
Applying resiliency to client applications
Consuming endpoints using a declarative method
Using Docker for deployment
Chapter 11: Batch and Message-Driven Processes
Building synchronous batch processes
Implementing batch processes with a database
Constructing asynchronous batch processes
Building synchronous interprocess communication using AMQP
Creating asynchronous send-receive communication
Creating an event-driven asynchronous communication using AMQP
Creating stream communication with Spring Cloud Stream
Implementing batch processes using Spring Cloud Task
Chapter 12: Other Spring 5 Features
Using Hibernate 5 object-relational mapping
Applying Hazelcast distributed caching
Building client-server communications with WebSocket
Implementing Reactive WebSocket communication
Implementing asynchronous Spring Data JPA properties
Implementing Reactive Spring Data JPA repositories
Using Spring Data MongoDB
Building applications for big data storage
Building a Spring 5 application using Kotlin
Chapter 13: Testing Spring 5 Components
Creating tests for Spring MVC components
Building standalone controller tests
Creating tests for DAO and service layers
Creating tests on secured applications
Creating tests using Spring Boot 2.0
Creating tests for Spring Data JPA
Building tests for blocking, asynchronous and reactive RESTful services
Building tests for Kotlin components

Book Details

ISBN 139781787128316
Paperback670 pages
Read More

Read More Reviews

Recommended for You

Spring 5 Design Patterns Book Cover
Spring 5 Design Patterns
$ 35.99
$ 25.20
Building Web Apps with Spring 5 and Angular 4 Book Cover
Building Web Apps with Spring 5 and Angular 4
$ 39.99
$ 28.00
Spring Boot Cookbook - Second Edition Book Cover
Spring Boot Cookbook - Second Edition
$ 35.99
$ 25.20
Spring Security - Third Edition Book Cover
Spring Security - Third Edition
$ 39.99
$ 28.00
Spring 5.0 Core Training [Video] Book Cover
Spring 5.0 Core Training [Video]
$ 124.99
$ 106.25
Spring 5.0 Project: Building a Travel Website [Video] Book Cover
Spring 5.0 Project: Building a Travel Website [Video]
$ 124.99
$ 106.25