Monday, 23 June 2014

New CDI Material on JavaEE course

We've now added three new chapters covering CDI to the JavaEE course - a preview of the first chapter and the full story below!

When we recorded the JavaEE course, we wanted to cover all of the fundamental topics that every practicing JavaEE developer should know.

The course is still relevant for JavaEE 7 (although upgrading Glassfish can be a pain), but it's become clear that we did miss one topic that should be in there: CDI.

CDI is a replacement to what I call the "classic" dependency injection features that were added back in JavaEE 5. The classic DI is a bit weak - for example you are limited in the types of objects that are allowed to be injected.

CDI changes that and adds a much more flexible DI framework into JavaEE. It's very similar to Spring's Dependency Injection (if you're using annotations), or Google's Guice.

CDI was available when we recorded the course, but it was new and we didn't know if it would be used by real projects. Today it's clear that it is, so its important that we have it on the course.

We've now added 3 chapters to the course, and if you've already bought it, you get these chapters for free - just log on to your account as normal, and you will find the three chapters, with some additional code, at the bottom of the chapters list.

If you bought the course on DVD from a retailer, just send us a support call with your proof of purchase and we will set up an online account for you to download the chapters.


  1. Hi Richard,

    When following along with the second CDI video, I keep getting a NullPointerException, which you mention can be caused by a CDI problem. I'm stumped on how to solve this error. It appears to occur when I swap my @EJB to @Injection annotations for the DAO (and subsequently removing the @Stateless in the DAO). Compilation is fine and the build script reports no errors. I am wondering if this is an issue specific to Glassfish3, because in the videos you appear to use glassfish4. I'm using the glassfish3 version provided with the course along with java EE 6.

    Any help you can provide would be greatly appreciated.


  2. Hi Reeve, yes it may be a 3/4 problem as they use different versions of CDI. The best thing to do is raise a support call - go to the contact page at, follow technical help and fill in the details. Then either me or one of the team will be assigned to the case. Don't worry we will soon get it working again!