Home » Tag Archives: CDI (page 2)

Tag Archives: CDI

Playing with Weld-Probe – See All of your CDI Aspects in One Place

java-interview-questions-answers

Weld 3.0.0.Alpha4 was released, while I’ve been sitting in a conference room at DevConf.CZ. More or less next to Jozef Hartinger ( @jozefhartinger) who told me about the new awesome features of this latest release a few minutes before in a shared break. There is one particular feature, that really caught my attention which is the new Weld Probe mechanism.     What ...

Read More »

Integrating CDI and WebSockets

java-interview-questions-answers

Thought of experimenting with a simple Java EE 7 prototype application involving JAX-RS (REST), WebSockets and CDI. Note: Don’t want this to be a spoiler – but this post mainly talks about an issue which I faced while trying to use web sockets and REST using CDI as a ‘glue’ (in a Java EE app). The integration did not materialize, ...

Read More »

Java EE Interceptors

java-interview-questions-answers

History I think it’s important to take a look at the evolution of Interceptors in Java EE because of the simple fact that it started as an EJB-specific item and later evolved into a separate spec which is now open for extension by other Java EE specifications. Version 1.0 Interceptors were first introduced in EJB 3.0 (part of Java EE ...

Read More »

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 »

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:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns