Home » Tag Archives: CDI (page 2)

Tag Archives: CDI

Injecting configuration values using CDI’s InjectionPoint

java-interview-questions-answers

Dependency injection is a great technology for the organization of class dependencies. All class instances you need in your current class are provided at runtime from the DI container. But what about your configuration? Of course, you can create a “Configuration” class and inject this class everywhere you need it and get the necessary value(s) from it. But CDI lets ...

Read More »

Tutorial: Writing your own CDI extension

java-logo

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

java-logo

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

java-logo

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

java-logo

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 »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.