Lightning-fast and ultimately powerful Dependency Injection

What is ActiveJ Inject?

ActiveJ Inject is a lightweight and powerful dependency injection library with ultimate performance and no third-party dependencies. It is multi-thread friendly, feature-rich, and can boast with lighting-fast start-up time and runtime, significantly outperforming Spring DI or Guice.
ActiveJ Inject is one of the ActiveJ technologies, but it has minimal third-party dependencies and can be used as a stand-alone component.

Why ActiveJ Inject?

  • Supports annotation-based configuration as well as manual binding to escape reflection overhead
  • Bindings are grouped into Modules that can be reused in other applications
  • Optimized injectors for single-threaded and multi-threaded use cases
  • Ability to combine, override and transform bindings
  • Support for singletons, nested scopes and transient bindings
  • Dependency graph processing is performed once at startup time
  • Provides means to introspect the dependency graph
  • No third-party dependencies

Dependency Injection: Redefined

Enjoy development with a wide range of powerful tools. ActiveJ Inject simplifies development, debugging, refactoring and reusing of your code without restrictions and overhead.

The annotations processing is separated into a standard plugin that is used by default and allows for generation of missing dependencies. Yet if you need to implement a complex business logic, you can either use ActiveJ Inject DSL, or even create your own annotations processing plugins.

The DSL provides support for programmatic binding generation, introspections of dependencies graphs, transformations, automatic generation of missing bindings, and modification of the already existing bindings. This way you can use the full power of Java to algorithmically create complex bindings and dependencies graphs directly in runtime with respect to the runtime information and settings.

Module cookbook = new AbstractModule() {
	@Provides
	Sugar sugar() { return new Sugar("Sugar", 10.f); }

	@Provides
	Butter butter() { return new Butter("Butter", 20.0f); }

	@Provides
	Flour flour() { return new Flour("Flour", 100.0f); }

	@Provides
	Pastry pastry(Sugar sugar, Butter butter, Flour flour) {
		return new Pastry(sugar, butter, flour);
	}

	@Provides
	Cookie cookie(Pastry pastry) {
		return new Cookie(pastry);
	}
};
Injector.of(cookbook).getInstance(Cookie.class);

Benchmarks

We’ve compared ActiveJ Inject to Guice and Spring in the same scenario using JMH as the benchmark tool. We ran benchmarks in AverageTime mode and made 20 measurements.

Add ActiveJ Inject to your project

You can add ActiveJ Inject to your project by importing its Maven repository.
These docs cover the most recent release of ActiveJ Inject v4.0-beta1 (see on Github or Maven ).

Project background

ActiveJ Inject is one of the ActiveJ technologies that also include cloud solutions, lightning-fast serializers, bytecode generators and other technologies. To learn more about ActiveJ ecosystem, visit ActiveJ website.