The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning. Learn more →
Top 23 Java Dependency Injection Projects
-
Guice
Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 11 and above, brought to you by Google.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
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.
-
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.
-
Weld
Weld, including integrations for Servlet containers and Java SE, examples and documentation (by weld)
-
spring-examples
Starter projects with Spring using Java and Kotlin. Contains modules that covers Security with JWT, Spring with Kotlin, Dependency injection simplified etc.
-
mockito-object-injection
Mockito Object Injection for JUnit5. Inject Strings and other Objects directly into Mocks without needing setters or constructor injection.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Project mention: Dagger 2.49 (KSP, @AssistedInject with @HiltViewModel, more) | /r/androiddev | 2023-12-05
Project mention: Hexagonal Architecture/Ports And Adapters: Clarifying Key Concepts Using Go | dev.to | 2024-03-21Historically, Ports and Adapters was born in the context where Dependency Inversion Principle (DIP) was getting hot, back in the beginning of the 2000’s. DIP was getting more present on development day to day, and an example of a framework that was a pioneer in such topic is Google Guice.
Project mention: Is dependency injection really a hard topic ? Or am i just dumb ? | /r/androiddev | 2023-07-10Just 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.
Project mention: Apt-based dependency injection for server-side developers | news.ycombinator.com | 2023-11-21
Project mention: What library/framework would you recommend for creating a GUI desktop application? | /r/java | 2023-05-30
Project mention: JEP 457: Class-File API for Parsing, generating, transforming | news.ycombinator.com | 2023-09-26This 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.
Java Dependency Injection related posts
- Hexagonal Architecture/Ports And Adapters: Clarifying Key Concepts Using Go
- Inversion of Control Containers and the Dependency Injection Pattern (2004)
- Dagger 2.49 (KSP, @AssistedInject with @HiltViewModel, more)
- Apt-based dependency injection for server-side developers
- Dagger 2.48 adds alpha KSP support
- Is dependency injection really a hard topic ? Or am i just dumb ?
- Avaje Inject - Microservice Focused DI via Annotation Processing
-
A note from our sponsor - WorkOS
workos.com | 25 Apr 2024
Index
What are some of the best open-source Dependency Injection projects in Java? This list will help you:
Project | Stars | |
---|---|---|
1 | Dagger2 | 17,311 |
2 | Guice | 12,343 |
3 | Bootique | 1,412 |
4 | Toothpick | 1,116 |
5 | Governator | 822 |
6 | ActiveJ | 817 |
7 | apk-dependency-graph | 740 |
8 | Weld | 374 |
9 | Feather | 353 |
10 | transfuse | 219 |
11 | avaje-inject | 195 |
12 | Apache DeltaSpike | 147 |
13 | java-11-examples | 57 |
14 | JayWire | 54 |
15 | EasyDI | 49 |
16 | spring-examples | 36 |
17 | FlexiCore | 22 |
18 | colesico-framework | 15 |
19 | backbonefx | 15 |
20 | pouch | 14 |
21 | mockito-object-injection | 8 |
22 | WireDI | 5 |
23 | Jvault | 5 |
Sponsored