Home » Tag Archives: CDI (page 2)

Tag Archives: CDI

Updates on CDI 2.0

java-interview-questions-answers

CDI 2.0 is the next version of Contexts and Dependency Injection for the Java EE Platform and a candidate for inclusion in Java EE 8. It is being worked upon since September 2014 and moving pretty rapidly !                 Major goals for CDI 2.0 Alignment with Java SE 8 (of course!) Support for ...

Read More »

Simple Aspect Oriented Programming (AOP) using CDI in JavaEE

java-interview-questions-answers

We write service APIs which cater to certain business logic. There are few cross-cutting concerns that cover all service APIs like Security, Logging, Auditing, Measuring Latencies and so on. This is a repetitive non-business code which can be reused among other methods. One way to reuse is to move these repetitive code into its own methods and invoke them in ...

Read More »

Java EE CDI Qualifiers: Quick Peek

java-interview-questions-answers

Qualifiers are the mainstay of type safety and loose coupling in Contexts and Dependency Injection (CDI). Why? Without CDI, we would be injecting Java EE components in a manner similar to below Note:This will actually not compile and is just a hypothetical code snippet           Example 1   Example 2 What’s wrong with the above implementations? ...

Read More »

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 »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Advanced Java Guide
  • Java Design Patterns
  • JMeter Tutorial
  • Java 8 Features Tutorial
  • JUnit Tutorial
  • JSF Programming Cookbook
  • Java Concurrency Essentials