{"id":36706899,"url":"https://github.com/helospark/light-di","last_synced_at":"2026-01-12T11:43:34.260Z","repository":{"id":57724927,"uuid":"101509965","full_name":"helospark/light-di","owner":"helospark","description":"Fast, lightweight, Spring like, annotation driven dependency injection framework.","archived":false,"fork":false,"pushed_at":"2020-10-12T22:23:39.000Z","size":344,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-04T14:55:55.206Z","etag":null,"topics":["dependency-injection","fast","framework","java","lightweight","lightweight-framework"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helospark.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-26T19:59:41.000Z","updated_at":"2021-06-09T16:28:49.000Z","dependencies_parsed_at":"2022-09-10T23:56:51.947Z","dependency_job_id":null,"html_url":"https://github.com/helospark/light-di","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/helospark/light-di","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helospark%2Flight-di","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helospark%2Flight-di/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helospark%2Flight-di/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helospark%2Flight-di/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helospark","download_url":"https://codeload.github.com/helospark/light-di/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helospark%2Flight-di/sbom","scorecard":{"id":460629,"data":{"date":"2025-08-11","repo":{"name":"github.com/helospark/light-di","commit":"fd5e8d00f30ffa99a090a5be194eb453c1eb41c4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T11:03:09.454Z","repository_id":57724927,"created_at":"2025-08-19T11:03:09.454Z","updated_at":"2025-08-19T11:03:09.454Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-injection","fast","framework","java","lightweight","lightweight-framework"],"created_at":"2026-01-12T11:43:34.172Z","updated_at":"2026-01-12T11:43:34.250Z","avatar_url":"https://github.com/helospark.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"image:https://travis-ci.org/helospark/light-di.svg?branch=master[\"Build Status\", link=\"https://travis-ci.org/helospark/light-di\"]\nimage:https://img.shields.io/codecov/c/github/helospark/light-di.svg[\"Coverage\", link=\"https://codecov.io/gh/helospark/light-di\"]\nimage:https://img.shields.io/github/license/helospark/light-di.svg[\"MIT licence\", link=\"https://github.com/helospark/light-di/blob/master/LICENSE\"]\nimage:https://img.shields.io/badge/PRs-welcome-brightgreen.svg[\"PRs Welcome\", link=\"http://makeapullrequest.com\"]\n\n\n= LightDI\n\n*Fast, lightweight, Spring like, annotation driven dependency injection framework.*\n\nDesigned specifically for small applications, that has to have small memory footprint, small jar size and fast startup time, for example plugins, (embedded) standalone application, integration tests, jobs, Android applications, etc.\n\n== Features\n\n\n* Similar to Spring annotation-support.\n* Classpath scanning for beans\n* Android support\n* Stereotype annotations to create a bean `@Component`, `@Service`\n* Component scan at compile time\n* `@Configuration` can be applied to classes, annotated class can contain multiple `@Bean` annotated methods, these methods will be automatically called, and their return value will be injected to the context\n* `@Autowired` can be applied to constructor, fields, setters to automatically set dependency (or even collection of dependencies)\n* `@Value` can be applied to constructors, fields, setters to get value from property file\n* `@PropertySource` annotation can be set to components to load property files\n* `@PostConstruct/@PreDestroy` annotations can be applied to methods to run post construct and pre destroy respectively\n* `@Scope(\"prototype\") / @Scope(\"singleton\")` can be applied to beans, prototype scope bean will be recreated for each getBean, singleton beans will be shared in the application context\n* `@Lazy`, `@Eager` can be used to make beans initializing lazily or eagerly. (Lazy bean means slightly different thing than in Spring, see below limitation)\n* By default all beans are lazily initialized\n* `@Primary` can be used to declare a bean as primary in case of bean collision (useful for mocking out dependencies)\n* `@ComponentScan` and `@Import` support to load more beans in other packages\n* Conditional bean support, based on existence of other beans, classes, properties\n* JUnit test support (`@Autowire` to test, and automatically create Mockito mocks (`@MockBean`, `@SpyBean`) and inject into the test to test)\n* Fast startup time, small memory footprint (see performance section (soon))\n\n== Samples\n\nSee samples in:\n\nhttps://github.com/helospark/lightdi-samples\n\n== Usage\n\n=== Include library\n\nInclude the jar file in your project.\nYou can do this using Maven:\n\n[source,xml]\n     \u003cdependency\u003e\n      \u003cgroupId\u003ecom.helospark\u003c/groupId\u003e\n      \u003cartifactId\u003elightdi\u003c/artifactId\u003e\n      \u003cversion\u003e${lightdi.version}\u003c/version\u003e\n     \u003c/dependency\u003e\n\n(Check mvnrespotiroy.com for the latest version).\n\nYou can also download the single-jar version from Maven central for direct usage:\n\nhttps://repo1.maven.org/maven2/com/helospark/lightdi/0.0.1/lightdi-{insert.light.version.here}-jar-with-dependencies.jar\n\n(jar-with-dependencies is a Maven classifier, if you would like to use the fat jar using Maven)\n\n=== Library usage\n\nAnnotate beans with above annotations\n\n[source,java]\n    LightDiContext context = lightDi.initContextByPackage(ConstructorDependency.class.getPackage().getName());\n    SomeClass someClass = context.getBean(SomeClass.class);\n    someClass.doSomething();\n\n_SomeClass (and all of it's dependencies) has to be annotated with @Component._\n\nIf you started a project with LightDI, but realize, that you will need more features that LightDI won't provide, you should be able to move to Spring relatively simply. It could be done by replacing annotation package names, and change the class that creates the context.\n\nIf you started a project in Spring, and only used DI features, moving to LightDI should also be fairly straightforward, following the above steps in reverse. Therefore you could get a more lightweight application.\n\n=== Notes for Android\n\nLightDI is usable for Android, but please note the following:\n\nThe library is built using Java 8, so you need to add the following option to your Gradle file:\n\n[source]\nandroid {\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n      }\n    }\n\nSince Android does not support runtime classpath scanning (see DexFile class), therefore compile time annotation processing is added.\nWhile this is a standard Java feature, IDEs may not turn it on by default to get support in Android Studio you need to enable it at:\n\n    Settings \u003e Build, Execution, Deployment \u003e Compiler \u003e Annotation Processors \u003e Enable annotation processing\n\nand add the LightDi jar as a annotationProcessor explicitly in your `build.gradle` file, like:\n\n[source]\n    dependencies {\n       ...\n       implementation 'com.helospark:lightdi:{version you would like to use}'\n       annotationProcessor 'com.helospark:lightdi:{version you would like to use}'\n       ...\n    }\n\n== Performance\n\nSee project: https://github.com/helospark/lightdi-performance-test\n\n_Statistics coming soon_\n\n== Limitation\n\nLightDI was designed to be much more lightweight than Spring, it also has many of Spring's feature lacking.\n\n* Only Java 8 supported at the moment, later it might be downgraded\n* LightDi does not use AOP, therefore if you manually call `@Component` class' methods, it will create new instances (even for singletons), therefore, you should not manually invoke these methods. If you need these beans, you can always inject it (and then it will be singleton)\n* In LightDI by default every Bean is lazy unless otherwise specified. Lazy means different things in Spring and LightDI. Spring will inject a proxy of a Lazy bean to other beans, and instantiates it when there is a call on the proxy, in LightDI it just means, until requested, it will not be instantiated (requested by getBean, or a dependency of an initialized bean)\n* _More will come soon_ \n\n== Incompatibilities between versions\n\n - 0.0.6\n -- When `@Value`'s property `required=false` and they key not available it will no longer fills String with empty String. For fields value is unchanged, for method `null` is passed. \n - 0.0.8\n -- When injecting a Collection of beans, beans witch are also collections but contain matching bean types are flatmapped (merged) (see MergeBeanListIT for example)\n - 0.0.9\n -- Beans created via `@Bean` will have autowired dependencies injected\n\n== Why another DI framework\n\nThis framework shamelessly copied the the usage and idea from Spring framework, even down to annotation names. So why I have not just used Spring instead?\n\nWhile Spring is great, but even with absolute minimal number of dependencies has a large size (in jars), it also takes long to start it up (ex. lazy context creation and startup cannot be achieved on first usage, since it is very expensive to start the context), also has fairly large memory footprint that is not good for embedded applications.\n\nFor several of my smaller project I found, that just the (Spring) DI framework used up more space in my jars, than all other dependencies (including my code) together.\n\nThere are already large number of other DI frameworks out there, but I have not been able to find another DI framework, that has classpath scanning, annotations support combined with fast startup time, low memory footprint, therefore the idea of LightDI was born.\n\n== Building and contribution\n\nYou can build using Maven:\n\n[source,bash]\n     mvn clean install -DskipGpgSign\n\nFeel free to open issues / pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelospark%2Flight-di","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelospark%2Flight-di","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelospark%2Flight-di/lists"}