Home » Tag Archives: CDI (page 3)

Tag Archives: CDI

Tutorial: Writing your own CDI extension

Today I will show you how to write a CDI extension. CDI provides a easy way for extending the functionality, like adding own scopes, enabling java core classes for extension, using the annotation meta data for augmentation or modification, and much more. In this tutorial we will implement an extension that will inject properties from a property file, as usual ...

Read More »

Basic Injection / Qualifiers, Scope

java-interview-questions-answers

This is a continuation of the DI/CDI Basics tackled last week  – in this post, I’ll be discussing Basic Injection, Qualifiers and Scope. In our last topic, there we’re a great deal of information regarding the concepts of DI/CDI, we also discussed how these beans or class loaded using the annotations  -that makes up the composition of the object and ...

Read More »

DI / CDI – Basics

Introduction (DI/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same – the difference is that usage and its purpose. DI (Dependency Injection) is the general term  – this feature is basically the one doing the bean discovery and bean wiring process ...

Read More »

Java EE CDI programmatic dependency disambiguation example – Injection Point inspection

java-interview-questions-answers

In this tutorial we shall see how we can avoid programmatic dependency disambiguation when injecting Java EE CDI beans. We have already shown in the Jave EE dependency disambiguation example how to avoid dependency disambiguation in CDI beans. Here we shall show you how to avoid dependency disambiguation in a dynamic way. We will achieve this by inspecting the injection ...

Read More »

Java EE CDI dependency disambiguation example

In this tutorial we shall show you how to avoid dependency disambiguation in CDI beans. In CDI we can achieve dependency injection for multiple implementations of an interface to different clients in an application. The problem of dependency disambiguation is how a client can call a specific implementation among different ones, without any errors occurring. To see how we can ...

Read More »

Java EE CDI Dependency Injection (@Inject) tutorial

java-interview-questions-answers

In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation provided by the CDI API to inject a CDI bean to another bean. In this way the bean can be used in an application, such as a JavaServer Faces application. CDI provides several ways ...

Read More »

Asynchronous CDI Events

Few days ago, during our regular code review, one of my colleagues raised a question what would happen — and if it’s even possible — when a CDI Observer (so a method with parameter annotated @Observes) would be invoked multiple times at the same time for different event instances. In other words, after producing few events, is it possible that ...

Read More »