autowiring CDI spring

CDI worse than Spring for autowiring?

Let’s face it, there are two kinds of developers: those that favor Spring autowiring because it alleviates them from writing XML (even though you can do autowiring with XML) and those that see autowiring as something risky. I must admit I’m of the second brand. In fact, I’d rather face a rabbied 800-pounds gorilla than use autowiring. Sure, it does all the job for you, doesn’t it? Maybe, but it’s a helluva job and I’d rather dirty my hands than let some cheap

CDI Weld

Managing unmanaged beans in CDI

During these (much deserved) vacations, I worked on a pet project of mine which uses CDI with the Weld implementation and SLF4J with the Logback implementation. The terms of the problem were very simple:  Iwanted the logs of my application to be displayed in a Swing table, i.e. a Logback appender had to write in a table. The table was managed in CDI but the appender was not: this was no surprise since many older-generation frameworks have a lifecycle management on their own. Prior-to-JEE6 Servl

CDI fest testng

TestNG, FEST et CDI

No, those are not ingredients for a new fruit salad recipe. These are just the components I used in one of my pet project: it’ss a Swing application in which I wanted to try out CDI. I ended up with Weld SE, which is the CDI RI from JBoss. The application was tested alright with TestNG (regular users know about my preference of TestNG over JUnit) save the Swing GUI. A little browsing on the Net convinced me the FEST Swing testing framework was the right solution: It offers a DSL for end-

CDI spring

Why CDI won't replace Spring

CDI is part of JavaEE 6 and that’s a great move forward. Now, there’s a standard telling vendors and developers how to do DI. It can be refined, but it’s here nonetheless. Norms and standards are IMHO a good thing in any industry. Yet, I don’t subscribe to some people’s points of view that this means the end of Spring. There are multiple DI frameworks around here and Spring is number one. Why is that? Because it was the first? It wasn’t (look at Avalon). My o

CDI Swing

Lessons learned from CDI in Swing

Sinced I dived into CDI, I explored classical Java EE uses. Then, I used CDI into a pet project of mine to see how it could be used in Swing applications. This article sums up what lessons I learned from itthis far. This article assumes you have some familiarity with CDI; if not, please read my previous articles on CDI (CDI an overview part 1 and part 2) or read the documentation. In my last attempts at Swing (I’m more of a web developer), I figured it could be nice to config

CDI

CDI, an overview - Part 2

In the previous part of CDI, we saw some injection, qualifiers and scope. Now, it’s time to browse through more advanced features. Producers Previous examples cannot resolve all our use-cases. Some of these include: injection of random valuesinjection of context-dependent valuein general, places where the injection process cannot be narrowed down to a simple new() These hint at a very well-known pattern, the factory. Factories are implemented in JSR-299 as producers. Let’s tak