Needle is an ultra-lightweight dependency injection framework for Java, similar to Spring. It simplifies the management of dependencies in your application, making your code more modular, testable, and maintainable.
- Lightweight: Minimal overhead, designed to be fast and efficient.
- Annotation-based: Use simple annotations to define dependencies.
- Automatic Dependency Resolution: Automatically resolves and injects dependencies.
- Integration: Easily integrates with other frameworks and libraries.
public class Main {
public static void main(String[] args) {
Needle init = Needle.init(Main.class);
}
}
@Component
public class ExampleService {
private String name;
}
@Component
public class SampleConfig {
@Component
SampleComponent create() {
return new SampleComponent();
}
}
@Getter
public class B {
@Wired
private C depC;
}
@Getter
public class SampleService {
private final SampleComponent sampleComponent;
public SampleService(SampleComponent sampleComponent) {
this.sampleComponent = sampleComponent;
}
}
Add the following dependency to your Maven project:
<dependency>
<groupId>dev.pixelib</groupId>
<artifactId>needle</artifactId>
<version>1.0.0</version>
</dependency>
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.