javaconfig spring

Integrate Spring JavaConfig with legacy configuration

The application I’m working on now uses Spring both by parsing for XML Spring configuration files in pre-determined locations and by scanning annotations-based autowiring. I’ve already stated my stance on autowiring previously, this article only concerns itself on how I could use Spring JavaConfig without migrating the whole existing codebase in a single big refactoring. This is easily achieved by scanning the package where the JavaConfig class is located in the legacy Spring XML conf

javaconfig method injection spring

Spring method injection with Java Configuration

Last week, I described how a Rich Model Object could be used with Spring using Spring’s method injection from an architectural point of view. What is missing, however, is how to use method injection with my new preferred method for configuration, Java Config. My start point is the following, using both autowiring (shudder) and method injection. public abstract class TopCaller { @Autowired private StuffService stuffService; public SomeBean newSomeBean() { return ne

method injection rich domain object spring

Rich Domain Objects and Spring Dependency Injection are compatible

I’m currently working in a an environment where most developers are Object-Oriented fanatics. Given that we develop in Java, I think that it is a good thing - save the fanatics part. In particular, I’ve run across a deeply-entrenched meme that states that modeling Rich Domain Objects and using Spring dependency injection at the same time is not possible. Not only is this completely false, it reveals a lack of knowledge of Spring features, one I’ll be trying to correct in this ar

hack

getCaller() hack

As developers, we should only call public APIs. However, the Java language cannot differentiate between public API and private stuff: as soon as a class and one of its method is public, we can reference the former and call the later. Therefore, we are exposed to the Dark Side of the Force, and sometimes tempted to use it. A good example of this terrible temptation is the sun.reflect.Reflection.getCaller(int) method. As its name implies, this evil piece returns which class called your current co

hibernate jooq persistence

No more Hibernate? Really?

I recently stumbled upon this punchy one-liner: No More Hibernate!. At first, I couldn’t believe what I read. Then, scrolling down, I noticed that the site was linked to jOOQ, a framework that advocates for SQL to have a first-class status in Java: SQL was never meant to be abstracted. To be confined in the narrow boundaries of heavy mappers, hiding the beauty and simplicity of relational data. SQL was never meant to be object-oriented. SQL was never meant to be anything other than

Java scala verbosity

On the merits of verbosity and the flaws of expressiveness

Java is too verbose! Who didn’t stumble on such a rant on the Internet previously? And the guy bragging about [Insert expressive language there], that which soon replace Java because it is much more concise: it can replace those 10 lines of Java code with a one-liner. Ah, the power! Unfortunately, in order to correlate conciseness with power (and verbosity with lack of power), those people take many shortcuts that once put into perspective make no sense at all. This article aims to surgic

duchess swiss soft-shake

Happy summer holidays

The time of the year has come for me to go on holidays. For two weeks, no technology watching, no tech post reading, no blogging, no coding and most important of all, no computer at all. If you belong to the group of people who already spent their holidays - or even worse, to those who do not have vacations, rejoice (or not)! Not only will I think about you, but when I go back, I’ll bring with me more Vaadin sweetness: On September 11th, I’ll be leading a Vaadin 7 workshop under th