You are previewing JBoss Weld CDI for Java Platform.
O'Reilly logo
JBoss Weld CDI for Java Platform

Book Description

Learn CDI concepts and develop modern web applications using JBoss Weld

  • Learn about dependency injection with CDI

  • Install JBoss Weld in your favorite container

  • Develop your own extension to CDI

  • Decouple code with CDI events

  • Communicate between CDI beans and AngularJS

In Detail

CDI simplifies dependency injection for modern application developers by taking advantage of Java annotations and moving away from complex XML, while at the same time providing an extensible and powerful programming model.

"JBoss Weld CDI for Java Platform" is a practical guide to CDI's dependency injection concepts using clear and easy-to-follow examples. This will help you take advantage of the power behind CDI, as well as providing a firm understanding of how to use it within your applications.

"JBoss Weld CDI for Java Platform" covers all the major aspects of CDI, breaking it down into understandable pieces. This book will take you through many examples of how these concepts can be utilized, helping you get up and running quickly and painlessly.

"JBoss Weld CDI for Java Platform" gives you an insight into the different scopes provided by CDI and the use cases for which each has been designed. You will learn everything about dependency injection, scopes, events, producers, and more from JBoss Weld CDI, as well as how producers can create new beans for consumption within your application. You will also learn how to build a real world application with CDI using JSF and AngularJS for different web interfaces.

Table of Contents

  1. JBoss Weld CDI for Java Platform
    1. Table of Contents
    2. JBoss Weld CDI for Java Platform
    3. Credits
    4. About the Author
    5. About the Reviewer
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. What is a Bean?
      1. The history of beans
      2. Definition of a bean
      3. Is my class a bean?
      4. What does it mean to be a bean?
        1. Bean types
        2. Qualifiers
        3. Scope
        4. Expression Language (EL)
        5. Alternatives
      5. Which classes are beans?
        1. Managed Beans
        2. Session Beans
        3. Producers
          1. Producer methods
          2. Producer fields
      6. Summary
    9. 2. Dependency Injection and Lookup
      1. What is an injection point?
        1. Typesafe resolution
      2. Qualifiers
        1. @Default and @Any
        2. Qualifier members
      3. Alternatives
      4. Resolving Weld deployment errors
      5. Client proxies
        1. Unproxyable bean types
      6. Programmatic lookup of contextual instances
      7. Injection point metadata
      8. Summary
    10. 3. Deploying JBoss Weld
      1. JBoss Weld distribution
      2. JBoss AS
      3. Glassfish
      4. Apache Tomcat
      5. Summary
    11. 4. Scopes and Contexts
      1. Scope types
      2. Built-in scopes
        1. The request context lifecycle
        2. The session context lifecycle
        3. The application context lifecycle
      3. The conversation scope
        1. The conversation context lifecycle
        2. Conversation propagation
        3. Conversation timeout
      4. Pseudo scopes
      5. Custom scopes
      6. Summary
    12. 5. Producers
      1. The scope of a producer
      2. Injection into producer methods
      3. Dependent beans for producers
      4. Cleanup of produced beans
      5. Summary
    13. 6. Interceptors and Decorators
      1. Interceptor bindings
      2. Creating and enabling an interceptor
      3. Advanced interceptors
        1. Interceptor binding types with members
        2. Combining interceptor binding types
        3. Inheritance of interceptor binding types
      4. What is a decorator delegate?
      5. Enabling a decorator
      6. Summary
    14. 7. Events
      1. What is a payload?
      2. How do I listen for an event?
      3. How do I fire an event?
      4. Event qualifiers
        1. Members of event qualifiers
        2. Combining event qualifiers
      5. Observing events in different transaction phases
      6. Event-observer bean creation
      7. Summary
    15. 8. Writing a Portable Extension
      1. What is a portable extension?
      2. What is the CDI container lifecycle?
      3. BeanManager
      4. Injection into non-container managed instances
      5. Registering a bean
        1. Replacing annotations on a type via an extension
      6. Summary
    16. 9. Book Store – CDI Services
      1. Overview of the application
      2. Adding interceptors for our services
        1. Securing methods with an interceptor
        2. Providing a transaction with an interceptor
      3. Creating CDI services
      4. Summary
    17. 10. Book Store – User Interfaces
      1. REST services
      2. User interface for customers
      3. Administration interface
      4. Summary
    18. Index