Book Image

Java EE 7 Development with WildFly

Book Image

Java EE 7 Development with WildFly

Overview of this book

Table of Contents (21 chapters)
Java EE 7 Development with WildFly
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Introducing Contexts and Dependency Injection


CDI for the Java EE platform introduces a standard set of component management services to the Java EE platform. As a component of Java EE 7, CDI is in many ways a standardization of concepts that have been brewing in Spring for a long time, such as dependency injection and interceptors. In fact, CDI and Spring 3 share many similar features. There are also other dependency injection frameworks available for developers that are more lightweight and easier to use in a Java SE environment. Google Guice (https://github.com/google/guice) is a notable example. Providing full-blown support for the CDI container in a standalone Java SE application and separation from the application server are one of the goals of the upcoming CDI 2.0 specification. This will allow developers to use a common programming model on both client and server sides.

CDI lets you decouple concerns by what it refers to as loose coupling and strong typing. In doing so, it provides...