spring-injector

A fast alternative to the Spring @Configurable magic.

License

License

GroupId

GroupId

com.github.sabomichal
ArtifactId

ArtifactId

spring-injector
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

spring-injector
A fast alternative to the Spring @Configurable magic.
Project URL

Project URL

https://github.com/sabomichal/spring-injector
Source Code Management

Source Code Management

https://github.com/sabomichal/spring-injector

Download spring-injector

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.sabomichal/spring-injector/ -->
<dependency>
    <groupId>com.github.sabomichal</groupId>
    <artifactId>spring-injector</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.sabomichal/spring-injector/
implementation 'com.github.sabomichal:spring-injector:1.0'
// https://jarcasting.com/artifacts/com.github.sabomichal/spring-injector/
implementation ("com.github.sabomichal:spring-injector:1.0")
'com.github.sabomichal:spring-injector:jar:1.0'
<dependency org="com.github.sabomichal" name="spring-injector" rev="1.0">
  <artifact name="spring-injector" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.sabomichal', module='spring-injector', version='1.0')
)
libraryDependencies += "com.github.sabomichal" % "spring-injector" % "1.0"
[com.github.sabomichal/spring-injector "1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework : spring-core jar 4.3.17.RELEASE
org.springframework : spring-context jar 4.3.17.RELEASE
javax.inject : javax.inject jar 1
cglib : cglib jar 3.2.5

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.springframework : spring-test jar 4.3.17.RELEASE

Project Modules

There are no modules declared in this project.

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.

Versions

Version
1.0