Javascript

I am looking for a very lightweight dependency injection framework for java. With the minimum possible dependencies and the minimum features.

Just something along the following lines: get java.util.List

from Class

es, create them, and just auto-connect all objects to each other.

+2


source to share


6 answers


I would recommend Spring as it can provide a small footprint when using only the core packages.



If you think Spring is overkill then maybe PicoContainer or guice ?

+9


source


Maybe you should take a look at Google Guice: http://code.google.com/p/google-guice/



+8


source


Silk DI is a 120K

single jar file with no additional runtime dependencies. It has a fluent binder interface like goose but is more flexible and allows you to remove unneeded features. For example. Collection

or List

can be added to one liner.

+3


source


I have tried MentaContainer for less than a week and am happy with its clean and straightforward API. Instead of using XML or annotations for customization, it uses a fluent API almost like a DSL, which felt like heaven to me because I use it to create a small IoC-enabled web container. It provides a THREAD area for components that are ideal for the REQUEST area of ​​a web container. It's very lightweight so this might be what you need.

+2


source


Definitely look at Guice. Been using it for a year and absolutely loved it.

0


source


Take a look at google-designed dagger2 (bifurcated by square dagger1) for just 17kb.

  • Much less formulaic than a goose.
  • injection check time compilation (with explicit error message. Something spring, guice really not)
  • generate Facotries codes when compiled. Very powerful

dagger2 documentation dagger2 github examples dagger2

0


source







All Articles