Are you going to JavaOne? Well I’m not! But instead I’ll be doing some talks in October and November in Europe and Morocco. Four years ago I toured central Europe giving CDI talks. Next week I’ll start another tour with CDI and Forge talks. Here is my schedule : Tuesday 20th of October – JUG Frankfurt (Map) : Talk on JBoss Forge […]
If you want to learn about CDI you can read the 4 articles I wrote in the Java Magazine : Part I : Using strong typing in dependency injection (May/June 2015). This article covers basic dependency injection with CDI, @Inject, Qualifiers and Alternatives. Part II : Integrating third-party frameworks (July/August 2015). Covers Producers, InjectionPoint API and Diposers Part III : Loose coupling (September/October […]
I’m happy to announce that my course on CDI 1.1 has been published on PluralSight. This 3:40 hours long course is divided in several modules : Introduction (17:48) : Why do we need dependency injection in our applications, how do we usually do it, how can CDI help us Understanding Context and Dependency Injection (20:24) : Get the basis of […]
Here we are, using H2 in our test environment, Derby in development and Postgres in production. It’s 2014, and Java EE still doesn’t have a decent configuration specification… So how do we change datasources in Java EE depending on our environment ? There are several possibilities (from external property files, Maven resource filtering, Maven profiles with different configuration or JNDI tricks) but this […]
I am the author of several Java EE courses for Pluralsight. Plurasight has been around for more than 10 years, and has an impressive catalog of courses, several on Java and Java EE. Here is my contribution on Java EE courses : Java EE: The Big Picture (1:07 hour long) – Beginner Java Platforma and Java EE Overview What Is Java EE? Is Java […]
It's 2012 and my first resolution of the year is to finally tell the truth about testing : unit testing is pretty much useless when your code runs inside a container. How do you unit test an EJB which relies on the container services (i.e transaction, injection, security...) ? Well, you mock the database access, you mock your security layer, you mock your dependencies, you mock your validation layer... to test what ? A bit of business logic. Yes. Unit test is interesting when you have complex business logic to test so you can have quick feedback. Otherwise, it's a waste of time which doesn't test your container services. So I'm not saying unit testing is completely useless, I'm saying that integration testing is also to be considered when you run your code inside a Java EE container.
If you follow this blog you should know that latelly I've been writing (and talking) about CDI (Contexts and Dependency Injection). CDI has many aspects to it but until now I've focused on how to boostrap CDI in several environments, how to add CDI to an existing Java EE 6 application, and more recently how to use injection with CDI. Actually this post is the third on CDI Injection : Part I focused on default injection and qualifiers, and Part II on all the possible injection points (field, constructor and setters). In this post I'll explain producers or "how you can inject anything anywhere in a type safe manner".