top | item 30987168

(no title)

amoe_ | 3 years ago

I like Spring, Spring Boot is good, and the libraries do stuff that you'll need (while maybe you don't realize whether you'll need it yet).

I'm a DI fan and I've found alternative DI frameworks to not work as well as Spring's DI. I'm only talking about Spring's annotation-based configuration.

There are also several good reasons not to like it, though: the errors can be unbelievably confusing, and it's quite hard to get a good mental model of how and why things are done in it.

discuss

order

throwaway2037|3 years ago

Caveat: I always avoid DI frameworks / libraries if possible. I just add an AppContext to all of my projects, then write "10,000 new()'s" in one place. That is my wiring. That said, I don't want to hate on people who are productive with DI frameworks / libraries. There is more than one way to do it well!

Real question: When Google Guice came out, there was a hype about it was better than Spring DI. Honestly, I think part of the hype came from their amazing PR, courtesy of "Crazy Bob". Have you tried it, and what did you think? If not, what other DI frameworks / libraries have you tried? Why did you prefer Spring? I am throwing zero share here. I am genuinely curious!

amoe_|3 years ago

It's been a while since I last was experimenting with them. I did try Guice briefly, but I stopped for some reason that I don't recall now. Perhaps I should have given it more time. Dagger I tried in a bit more detail, and I found the code-generation aspect of it to be unpleasant and not sufficiently abstracted. I don't know if that could have been addressed by IDE configuration, plugins, etc, but I had to stop working on that project.