Java Dependency Injection

Open-source Java projects categorized as Dependency Injection

Top 23 Java Dependency Injection Projects

  • Dagger2

    A fast dependency injector for Android and Java.

    Project mention: Dagger 2.49 (KSP, @AssistedInject with @HiltViewModel, more) | /r/androiddev | 2023-12-05
  • Guice

    Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 8 and above, brought to you by Google.

    Project mention: Inversion of Control Containers and the Dependency Injection Pattern (2004) | news.ycombinator.com | 2024-02-21

    “There are many advantages to using dependency injection, but doing so manually often leads to a large amount of boilerplate code to be written. Guice is a framework that makes it possible to write code that uses dependency injection without the hassle of writing much of that boilerplate code”

    This is a common misconception. Guice’s docs delineate between dependency injection as a pattern and Guice as a framework that supports that pattern.

    https://github.com/google/guice/wiki

  • WorkOS

    The modern API for authentication & user identity. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • Bootique

    Bootique is a minimally opinionated platform for modern runnable Java apps.

  • Toothpick

    A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.

    Project mention: Is dependency injection really a hard topic ? Or am i just dumb ? | /r/androiddev | 2023-07-10

    Just as an alternative, the library toothpick focused on one concept, scopes, much easier for anyone on Android to grasp. You have application scope, activity scope, fragment scope and custom scope. Even while reading this, I'm sure you already understand what each of those represent. Having said that, it wasn't able to solve most of the other implementation complexities beyond better conceptual abstractions.

  • Governator

    Governator is a library of extensions and utilities that enhance Google Guice to provide: classpath scanning and automatic binding, lifecycle management, configuration to field mapping, field validation and parallelized object warmup.

  • ActiveJ

    ActiveJ is an alternative Java platform built from the ground up. ActiveJ redefines core, web and high-load programming in Java, providing simplicity, maximum performance and scalability

  • apk-dependency-graph

    Android class dependency visualizer. This tool helps to visualize the current state of the project.

  • LearnThisRepo.com

    Learn 300+ open source libraries for free using AI. LearnThisRepo lets you learn 300+ open source repos including Postgres, Langchain, VS Code, and more by chatting with them using AI!

  • Weld

    Weld, including integrations for Servlet containers and Java SE, examples and documentation (by weld)

    Project mention: Implement a plugin architecture | /r/JavaFX | 2023-03-01

    I've been using CDI for something like this. The project is temporarily hosted here.

  • Feather

    Lightweight dependency injection for Java and Android (JSR-330) (by zsoltherpai)

  • transfuse

    :syringe: Transfuse - A Dependency Injection and Integration framework for Google Android

  • avaje-inject

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

    Project mention: Apt-based dependency injection for server-side developers | news.ycombinator.com | 2023-11-21
  • Apache DeltaSpike

    Mirror of Apache Deltaspike

  • java-11-examples

    JDK 11 examples and demo projects.

  • JayWire

    JayWire Dependency Injection

  • EasyDI

    Easy Dependency Injection for Java (by manuel-mauky)

  • spring-examples

    Starter projects with Spring using Java and Kotlin. Contains modules that covers Security with JWT, Spring with Kotlin, Dependency injection simplified etc.

  • FlexiCore

    FlexiCore is a plugin based spring powered framework

    Project mention: FlexiCore - an Open Source plugin spring-based java framework | /r/java | 2023-02-26
  • colesico-framework

    Micro framework for creating server side applications in Java 17+

  • backbonefx

    Opinionated set of tools for creating JavaFX apps

    Project mention: What library/framework would you recommend for creating a GUI desktop application? | /r/java | 2023-05-30
  • pouch

    A Java library for implementing the Service Locator design pattern. (by cowwoc)

  • mockito-object-injection

    Mockito Object Injection for JUnit5. Inject Strings and other Objects directly into Mocks without needing setters or constructor injection.

    Project mention: JEP 457: Class-File API for Parsing, generating, transforming | news.ycombinator.com | 2023-09-26

    This is pretty exciting... I've used them all libraries at this point in my career: CGLib, ASM, BCEL, ByteBuddy, Javassist, etc... each has its pluses and minuses. I've designed everything from profiling agents, to systems that pack decimals into EBCDIC and invoke COBOL programs on big IBM iron, to lightweight JIT compilers, all using these libraries.

    > In 2002, the visitor approach used by ASM seemed clever

    I couldn't agree more. The visitor pattern was very hard to explain/justify back then, and still difficult to explain to newbie programmers just entering the profession.

    Looking at the examples, I think this is going to be an official replacement for ASM, meaning it's going to be pretty low level. The use of streams pretty straightforward.

    If anyone from the JEP is reading this: I have two pieces of feedback!

    First, take some inspiration from the way CDI Portable Extensions work. This is probably the most delightful extension API I've ever used. The @Observe callbacks are super simple to explain to people and it's really easy to write extensions for the framework.

    Next, I wouldn't ignore the need for a higher-level API akin to ByteBuddy or Javassist. Sometimes I just want to write an interpreter or intercept a method call and thats it.

    For example in my Junit/Mockito extension https://github.com/exabrial/mockito-object-injection I need to intercept a call to the class under test in order to lazily inject dependencies at the last possible moment. While I certainly could do this with ASM, Javassist makes this fairly simple with it's MethodHandler api.

    Side note, it's a damn shame we don't have a mobile operating system that is JVM native :/ All this cool APIs simply never reach a huge number of devices.

  • WireDI

    WireDI is a IOC-Framework, that bridges compile time and runtime dependency injection

  • Jvault

    💙 Java DI library for package encapsulation

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2024-02-21.

Java Dependency Injection related posts

Index

What are some of the best open-source Dependency Injection projects in Java? This list will help you:

Project Stars
1 Dagger2 17,260
2 Guice 12,299
3 Bootique 1,411
4 Toothpick 1,116
5 Governator 821
6 ActiveJ 785
7 apk-dependency-graph 740
8 Weld 373
9 Feather 353
10 transfuse 220
11 avaje-inject 186
12 Apache DeltaSpike 147
13 java-11-examples 58
14 JayWire 54
15 EasyDI 49
16 spring-examples 35
17 FlexiCore 22
18 colesico-framework 15
19 backbonefx 15
20 pouch 13
21 mockito-object-injection 8
22 WireDI 5
23 Jvault 5
Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com