Show HN: Lightweight Runtime DI for Java Using Class-File API and JSR-330

Share This Post

Built a compact DI container for Java that avoids the pain points of Dagger 2’s compile-time graph generation and the overhead of Spring/Guice’s runtime reflection.

A key insight, suggested by Gemini and several other LLMs, is to use JDK 24’s Class-File API for zero-reflection classpath scanning, and then MethodHandles for fast object instantiation. The solution is JSR-330 compliant.

Migrated a real project (Dimension-UI) from Dagger 2 in 2 days. Key improvements:
– No bytecode generation or proxying magic
– Actual testability (isolated unit tests now work)
– 19KB footprint vs 10MB+ for Spring
– Startup is instant

Links

Dimension‑DI: https://github.com/akardapolov/dimension-di
Dimension‑UI: https://github.com/akardapolov/dimension-ui

DI Containers Comparison: https://github.com/Heapy/di-comparison


Comments URL: https://news.ycombinator.com/item?id=45821919

Points: 1

# Comments: 0

Source: github.com

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Experimenting with Vibration Sensors – Characterize RPM of Spinning Devices

Article URL: https://community.element14.com/challenges-projects/design-challenges/experimenting-with-vibration-sensors/b/blog/posts/experimenting-with-vibration-sensors—characterize-rpm-of-spinning-devices-5-fourier-transform-analysis-to-find-rpm Comments URL: https://news.ycombinator.com/item?id=45825929 Points: 1 # Comments: 0 Source: community.element14.com

I Built a Local Dev Tool for ChatGPT Apps SDK

Article URL: https://itsnikhil.github.io/blog/posts/oai-app-composer/ Comments URL: https://news.ycombinator.com/item?id=45825917 Points: 1 # Comments: 1 Source: itsnikhil.github.io

Do You Want To Boost Your Business?

drop us a line and keep in touch

We are here to help

One of our technicians will be with you shortly.