Hacker News new | ask | show | jobs
by sirsean 6204 days ago
I have to use Spring at work in a pretty large Enterprise Java environment, and our setup is not as you describe.

Despite Spring's message of conformity, it doesn't actually force you to program everything as singletons and beans.

1 comments

I concur. I also use Spring at my dayjob, without the problems the OP describes.

Spring is really useful for setting up the underlying infrastructure/plumbing/cross cutting concerns of a system - however, you don't have to use it for all your domain logic too. Don't drink the dependency injection cool-aid. :)

I like dependency injection for wiring together configured singletons (such as factories). What I don't like is a trivial constructor and then injection via setters. Constructors should produce objects ready for use, and Spring tolerates doing it that way (though it seems to prefer setters).