Sergi Almar blog (Java, Spring Framework…)

Menú principal

Navegador de artículos

Spring Puzzler #01: Welcome

I’ve spent the last two years and a half delivering the official SpringSource courses all over the world and during this time I’ve seen a lot of students coming across unexpected behaviors and wondering why. Based on Josh Bloch’s Java Puzzlers, I’m going to introduce you the Spring Puzzlers, a bunch of puzzlers ranging from Spring configuration gotchas to AOP and dynamic proxy voodoo, transactional enigmas…

So here’s the first one🙂

Our entry point will be a WelcomeService, a really simple interface with a single method welcome:

public interface WelcomeService {
void welcome(String name);
}

The implementation uses a LocalizedWelcomePrinter to print the localized message to the console. I’ll be using JSR-330 annotations for the DI :