See the basic example at: examples/basic-di/pom.xml

Add dinject as a dependency.


Java APT - dinject-generator

Add dinject-generator as a dependency with provided scope.

<!-- Annotation processor -->

Kotlin KAPT - dinject-generator

See example at: examples/basic-di-kotlin-maven/pom.xml

For use with Kotlin we register dinject-generator as a KAPT processor to the Kotlin compiler.

The easiest way to do this is to add the io.dinject.kapt:dinject:1.11 maven tile in build / plugins like:




The above includes the dinject-generator annotation processor only. For use with Javalin we instead include the io.dinject.kapt:javalin:1.11 tile.

With Kotlin KAPT the source code isn't generated automatically on compile (as it is with Java) but instead we can specify the source code to be re-generated via:

Maven - Project - Right mouse - Generate Sources and update folders