Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.31 KB

README.md

File metadata and controls

31 lines (22 loc) · 1.31 KB

Maven Central

spring-injector

A fast alternative to the Spring @Configurable magic.

Do you need to inject spring beans into non managed e.g. domain objects? Are you tired of slow aspectj compilation or load-time weaving? Then spring-injector is the solution.

This project is based on the Spring Injector from Apache Wicket project.

Usage

In order to inject dependents into any object just call SpringInjector.get().inject(this). And that's it!

public class DependentComponent implements Serializable {
	private static final long serialVersionUID = 1L;

	@Inject
	private InjectedComponent injectedComponent;

	public DependentComponent() {
		SpringInjector.get().inject(this);
	}

	public int answer() {
		return injectedComponent.answer();
	}
}

See the test classes for more detailed use case.

If you like it, give it a star, if you don't, please write an issue.