Chapter 2. Dependency Injection and Lookup

In this chapter, we will delve into the details of typesafe dependency injection, qualifiers, alternatives, client proxies, as well as provide insight into the rules that Weld uses to determine which bean to provide for each injection point. We'll finish up with how to programmatically retrieve beans directly from your application.

What is an injection point?

An injection point is identified by the @Inject annotation. Previously, we covered a nondefault constructor for a bean that was annotated with @Inject, as shown in the following code:

public class PaymentProcessor {
  private final Payment payment;

  @Inject
  public PaymentProcessor(Payment payment) {
    this.payment = payment;
  }
}

This is known as bean constructor ...

Get JBoss Weld CDI for Java Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.