Last week I switched a basic Spring app to Guice, the new dependency-injection framework from Google. It’s nice, it’s quick, and it does what it says on the box, but one thing bothers me. I know it’s not really logical, but it’s like a rock in my shoe – I need to import com.google.inject annotations (@Inject) into the classes that need an object injected. I have only done the most basic quick start stuff, and you may not need it, but that’s what the quick start says.
OK, so the POJOs that make up your app are still container agnostic, but somehow it kind of smells to be putting stuff that details how your container is going to manage the code into your code – even if it is only metadata. Maybe it is not so much the actual metadata per se. After all, describing usage of a class is what it is supposed to do. But com.google imports? Even if it was org.something it would be better, but something just doesn’t sit well here. I may need to digest what this means. It’s really skirting that line of putting runtime details back into POJOs. Hmm…