https://github.com/coditory/quark-context
Coditory Quark Context is a lightweight and single purpose java library with IoC container
https://github.com/coditory/quark-context
coditory-quark dependency-injection ioc-container
Last synced: 2 months ago
JSON representation
Coditory Quark Context is a lightweight and single purpose java library with IoC container
- Host: GitHub
- URL: https://github.com/coditory/quark-context
- Owner: coditory
- License: mit
- Created: 2020-12-28T10:13:33.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-12-01T22:03:04.000Z (5 months ago)
- Last Synced: 2025-12-03T16:53:14.700Z (4 months ago)
- Topics: coditory-quark, dependency-injection, ioc-container
- Language: Java
- Homepage:
- Size: 409 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Quark Context
[](https://github.com/coditory/quark-context/actions/workflows/build.yml?query=branch%3Amain)
[](https://codecov.io/github/coditory/quark-context)
[](https://mvnrepository.com/artifact/com.coditory.quark/quark-context)
**🚧 This library as under heavy development until release of version `1.x.x` 🚧**
> Lightweight, single purpose, dependency injection java library. Similar to [IoC Container provided by Spring Framework](https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans) but lighter.
- lightweight, exactly 3 minimalistic dependencies
- single purpose, not part of a framework
- provides both functional and annotation based API
- has conditional bean registration mechanism
- detects slow bean creation
- provides [event bus](https://github.com/coditory/quark-eventbus) integration
- public API annotated with `@NotNull` and `@Nullable` for better [kotlin integration](https://kotlinlang.org/docs/java-to-kotlin-nullability-guide.html#platform-types)
## Installation
Add to your `build.gradle`:
```gradle
dependencies {
implementation "com.coditory.quark:quark-context:$version"
}
```
## Loading application context
When using annotations you could load context with a single line:
```java
public class Application {
public static void main(String[] args) {
Context context = Context.scanPackage(Application.class);
MyBean myBean = context.get(MyBean.class);
// ...
}
}
```
For more complicated setups use context builder:
```java
public class Application {
public static void main(String[] args) {
Context context = Context.builder()
.add(new MyBean())
.add(MyBean2.class, () -> new MyBean2())
.add(MyBean3.class, (ctx) -> new MyBean3(context.getBean(MyBean.class)))
.scanPackage(Application.class)
.build();
MyBean myBean = context.get(MyBean.class);
// ...
}
}
```