2 ms·
> it calls constructors to create dependency objects, and passes constructor parameters to inject them So, basically DI. This is the recommended mode of operat
by faangsticle 3y ago
> it calls constructors to create dependency objects, and passes constructor parameters to inject them
So, basically DI. This is the recommended mode of operation of Guice & Spring.
- moring 3y agoKeep in mind that I had to cram as much useful information as possible into a single headline. The GitHub page says "without _automatic_ dependency injection". What grumpyrest does is sometimes called "poor man's DI", although this term has been discouraged because it is quite useful. The important thing is that it does not rely on any DI framework / container, and especially not on automatic construction of dependencies or annotations.
- faangsticle 3y agoTo be clear, most (all?) DI frameworks are available with plain classes without annotations. They do use reflection to figure out which parameter goes where, but that's it. public class Foo { public Foo(Bar bar, Baz baz) {} } Is a perfectly valid class as far as most DI frameworks are concerned.
- jwfy2342___ 3y agoI don't find value in runtime DI frameworks, however I'm assuming there is a valid use case for them since they exist.
- faangsticle 3y agoInteroperability with libraries that can be loaded at runtime, and in general skipping a build step that would make development annoying to do.