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

unit testing

Shoud you change your design for testing purposes?

As Dependency Injection frameworks go, the standard is currently CDI. When switching from Spring, one has to consider the following problem: how do you unit test your injected classes? In Spring, DI is achieved through either constructor injection or setter injection. Both allow for simple unit testing by providing the dependencies and calling either the constructor or the desired setter. Now, how do you unit test the following code, which uses field injection: public class MyMainClass { @

Strategies to improve your knowledge

If you’ve got a professional attitude regarding your developer career, chances are you’re looking to improve your knowledge, whether it’s language-related or framework-related (or even process-related but it is more far-fetched). So far, I found the following ways to do so, each step bringing deeper knowledge than the former: The first strategy when you want to learn about something is to read about it. This is the easiest, since there are so many resources available online. Th

Swing

Properly closing Swing windows

There are many subjects one has to know when working with Swing and one of them is window closing. A beginner pass through some steps (and yes, I consider myself a beginner in Swing) and here are those I experienced myself. Hiding is default In the first step, you realize that by clicking the cross in the title bar, the window only disappears. It’s not disposed of, and if it’s your main application’s window, that’s bad because it means you’ve lost any handle on t

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

Win Free Copies of Learning Vaadin book

To celebrate the release of my new book, Learning Vaadin, Packt is giving away 3 copies especially to my blog readers. Keep reading to find out how you can be one of the lucky winners. Overview of Learning Vaadin Discover the Vaadin framework in a progressive and structured wayLearn about components, events, layouts, containers, and bindings Read more about this book and download a free sample chapter. How to Enter? Head on over to the book page and look through the product description