Book Image

Mastering Netbeans

5 (1)
Book Image

Mastering Netbeans

5 (1)

Overview of this book

Table of Contents (17 chapters)
Mastering NetBeans
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Contexts and Dependency Injection


One of the hot new features in Enterprise Java over recent years has been the Contexts and Dependency Injection (CDI) framework.

CDI allows us to interact with the context of objects by enabling binding to the different lifecycle methods of stateful components using annotations such as @PostContruct and @PreDestroy. It also provides a dependency injection framework, allowing components to be injected into other components using the @Inject annotation. We can choose different implementations of components to inject at deploy time, allowing a looser coupling of components leading to better and more structured architectures.

Note

For more information about CDI, refer to the Java EE 6 tutorial at http://docs.oracle.com/javaee/6/tutorial/doc/giwhb.html.

CDI is a huge subject that can be described in entire books such as JBoss Weld CDI for Java Platform, Ken Finnigan, Packt Publishing. In this section, we're assuming that you are familiar with CDI.

Adding CDI support...