Skip to content

Dependency injection via APT (source code generation) ala "Server side Dagger DI"

License

Notifications You must be signed in to change notification settings

zhudyos/avaje-inject

 
 

Repository files navigation

Build JDK EA License Maven Central : avaje-inject

APT based dependency injection for server side developers - https://avaje.io/inject

Example module use

module org.example {

  requires io.avaje.inject;

  provides io.avaje.inject.spi.Module with org.example.ExampleModule;
}
  • Uses Java annotation processing for dependency injection
  • Generates source code
  • Avoids any use of reflection or classpath scanning (so low overhead and fast startup)
  • A Library only (a DI library and that's it ~25k in size)

Differences to Dagger

  • Aimed specifically for server side development (rather than Andriod)
  • Supports lifecycle methods with @PostConstruct and @PreDestory
  • Supports @Factory and @Bean
  • Provides API to obtain all bean instances that implement an interface
  • Provides API to obtain all bean instances that have an annotation
  • Integration with server side web frameworks Javalin, Helidon

Spring DI

For comparison with Spring DI look at https://avaje.io/inject/#spring

About

Dependency injection via APT (source code generation) ala "Server side Dagger DI"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%