Book Image

Java EE 8 Design Patterns and Best Practices

By : Rhuan Rocha, Joao Carlos Purificação
Book Image

Java EE 8 Design Patterns and Best Practices

By: Rhuan Rocha, Joao Carlos Purificação

Overview of this book

Patterns are essential design tools for Java developers. Java EE Design Patterns and Best Practices helps developers attain better code quality and progress to higher levels of architectural creativity by examining the purpose of each available pattern and demonstrating its implementation with various code examples. This book will take you through a number of patterns and their Java EE-specific implementations. In the beginning, you will learn the foundation for, and importance of, design patterns in Java EE, and then will move on to implement various patterns on the presentation tier, business tier, and integration tier. Further, you will explore the patterns involved in Aspect-Oriented Programming (AOP) and take a closer look at reactive patterns. Moving on, you will be introduced to modern architectural patterns involved in composing microservices and cloud-native applications. You will get acquainted with security patterns and operational patterns involved in scaling and monitoring, along with some patterns involved in deployment. By the end of the book, you will be able to efficiently address common problems faced when developing applications and will be comfortable working on scalable and maintainable projects of any size.
Table of Contents (20 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
5
Aspect-Oriented Programming and Design Patterns
Index

Explaining the concept of an event in CDI


As reactive programming grew in the development environment, the Java language and Java EE needed to create tools to permit developers to develop systems using reactive programming. On Java EE, some solutions were introduced that made it possible to use the style function and to create processes asynchronously. One of these solutions is Event in CDI; this solution could launch a synchronous and blocking event, or an asynchronous and nonblocking event using CDI.

In CDI, Event is a solution that Java EE built using the observer pattern, making it possible to develop and launch an event to separate components doing the processing, working as a synchronous and blocking or asynchronous and nonblocking process. This separate task is an observer that reacts to an event launched with its data. In this chapter, we will focus on asynchronous CDI, using Event in CDI to launch asynchronous events.