Hacker News new | ask | show | jobs
by shepherdjerred 772 days ago
> @Inject just means I have no way of knowing the type of an object or how it is initialized without sifting through the entire code base looking for an @Provides.

If you're using interfaces correctly with strong contracts, the concrete implementation shouldn't matter.

This falls apart very quickly if your implementations don't match the contract.

Guice can be quite pleasant (though confusing at first) since it makes it easy to test your code and easily swap out implementations of classes, e.g. for dev vs prod.

1 comments

Guice is honestly the worst DI container I’ve ever used. It has no life cycle support and you have to hack around all of its features. Id take any of the popular ones over it. Spring/Avaje/CDI. Most likely Avaje since it most easily supports compile time injection.