Hacker News new | ask | show | jobs
by stitchy 5076 days ago
"So if you like constructor injection you have two options: component scanning or XML."

I only half agree that this is a limitation. I use as little component scanning as possible. I think it's better to scan for the configuration classes (hopefully there aren't many) and explicitly define the rest. I like this for two reasons, first for speed and second because everything is defined in a fairly central place. I can't tell you how many times I've been surprised by annotation based configuration.

Personally I like Spring's Java Configuration over Guice's. It's more flexible for my needs. Although I suppose that an argument could be made that that's the problem: configuration over convention.

I'm glad you mentioned the Guice style @inject is available with Spring now. I wasn't aware of that.

1 comments

I'm on the polar opposite end of this. We component scan everything we can, and I couldn't be happier. I have never once been surprised by what annotation based config assembled for me.

So, approaches may vary.