Compile-time bindings
Dependency bindings are type-checked by the compiler and if any dependency is missing or incompatible, an error message is emitted.
Appearance
for Java & Scala
Dependency injection at compile-time made simple, minimal-invasive and scalable
Dependency bindings are type-checked by the compiler and if any dependency is missing or incompatible, an error message is emitted.
Dependencies are created and (if desired) cached just-in-time by calling abstract methods, so that your application can startup quickly.
Dependencies are named, so that the compiler can always discern two dependencies named foo
and bar
, even if they have the same type.
All necessary code is generated by the compiler, so that there are no runtime artifacts and it doesn't break byte code analysis or transformation tools.
Dependencies are defined in module contexts or types. Module types can get composed into large systems by composition or inheritance.
Bali DI is implemented as an annotation processor in Java and as a def macro in Scala. You can even use it in mixed Java/Scala/Scala.js projects.
Bali DI is completely complementary to Spring, Guice, Macwire, CDI or any other JSR 330 implementation, so that you can use both technologies in the same project.
The Java annotation processor emits formatted source code, so that you can easily inspect your dependency bindings and their caching.
new
The design is based on abstract types, which are hard to implement manually. This is an effective deterrent to accidentally new
a dependency type.