Jakarta Contexts Dependency Injection 3.0
Total Page:16
File Type:pdf, Size:1020Kb
Jakarta Contexts and Dependency Injection Jakarta Contexts and Dependency Injection Spec Project lead by Antoine Sabot- Durand 3.0, July 30 2020 Table of Contents Preface. 1 Evaluation license . 1 Final license. 1 Eclipse Foundation Specification License - v1.0 . 1 Foreword . 2 Organisation of this document . 2 Major changes. 2 Introduction 4 1. Architecture . 5 1.1. Contracts. 6 1.2. Relationship to other specifications. 6 1.2.1. Relationship to the Jakarta EE platform specification. 6 1.2.2. Relationship to Jakarta Enterprise Bean. 7 1.2.3. Relationship to managed beans . 7 1.2.4. Relationship to Jakarta Dependency Injection . 8 1.2.5. Relationship to Jakarta Interceptors . 8 1.2.6. Relationship to Jakarta Server Faces . 8 1.2.7. Relationship to Jakarta Bean Validation . 8 1.3. Introductory examples . 8 1.3.1. Jakarta Server Faces example . 8 1.3.2. Jakarta Enterprise Bean example. 12 1.3.3. Jakarta EE component environment example . 12 1.3.4. Event example. 13 1.3.5. Injection point metadata example . 15 1.3.6. Interceptor example . 16 1.3.7. Decorator example. 18 Part I - Core CDI 20 2. Concepts . 21 2.1. Functionality provided by the container to the bean . 21 2.2. Bean types . 22 2.2.1. Legal bean types . 22 2.2.2. Restricting the bean types of a bean . 23 2.2.3. Typecasting between bean types . 23 2.3. Qualifiers . 23 2.3.1. Built-in qualifier types . 25 2.3.2. Defining new qualifier types . 26 2.3.3. Declaring the qualifiers of a bean . 26 2.3.4. Specifying qualifiers of an injected field . 27 2.3.5. Specifying qualifiers of a method or constructor parameter . 27 2.3.6. Repeating qualifiers. 28 2.4. Scopes . 29 2.4.1. Built-in scope types . 30 2.4.2. Defining new scope types. 30 2.4.3. Declaring the bean scope . 30 2.4.4. Default scope . 31 2.5. Default bean discovery mode . 31 2.5.1. Bean defining annotations . 32 2.6. Bean names . 33 2.6.1. Declaring the bean name . 33 2.6.2. Default bean names . 33 2.6.3. Beans with no name . 33 2.7. Alternatives . 34 2.7.1. Declaring an alternative . 34 2.8. Stereotypes . 34 2.8.1. Defining new stereotypes. 34 2.8.2. Declaring the stereotypes for a bean. 37 2.8.3. Built-in stereotypes . 37 2.9. Problems detected automatically by the container . 37 3. Programming model . 39 3.1. Managed beans. ..