{"id":20748862,"url":"https://github.com/gustavohennig/simpledependencymanager","last_synced_at":"2026-04-24T13:32:14.799Z","repository":{"id":72515027,"uuid":"223250313","full_name":"GustavoHennig/SimpleDependencyManager","owner":"GustavoHennig","description":"Simple Dependency Manager for Java, useful for small projects, Android Apps and Integration Tests","archived":false,"fork":false,"pushed_at":"2020-05-18T15:21:02.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-19T22:55:53.976Z","etag":null,"topics":["android","dependency-injection","inject","java","service-locator","unit-testing"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GustavoHennig.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-21T19:35:16.000Z","updated_at":"2022-01-04T13:20:48.000Z","dependencies_parsed_at":"2023-05-09T15:24:54.139Z","dependency_job_id":null,"html_url":"https://github.com/GustavoHennig/SimpleDependencyManager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GustavoHennig/SimpleDependencyManager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoHennig%2FSimpleDependencyManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoHennig%2FSimpleDependencyManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoHennig%2FSimpleDependencyManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoHennig%2FSimpleDependencyManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GustavoHennig","download_url":"https://codeload.github.com/GustavoHennig/SimpleDependencyManager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoHennig%2FSimpleDependencyManager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32225733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: 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":["android","dependency-injection","inject","java","service-locator","unit-testing"],"created_at":"2024-11-17T08:18:59.362Z","updated_at":"2026-04-24T13:32:14.783Z","avatar_url":"https://github.com/GustavoHennig.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n### Simply Dependency Manager\n\n\nThis project contains two different implementations of Dependency Injection. \n\n\n\n##### DependencyManagerTyped\n\nThis implementation is more like a service locator. It is more performative because it is typed, without the use of reflection.\n\nWorks passing the `Manager` to the constructor of every Business Logic Service.\n\nExample:\nhttps://github.com/GustavoHennig/SimpleDependencyManager/blob/master/src/test/java/simpledependecymanager/DependencyManagerTypedTest.java\n\nI found a post that explains the concept better:\nhttps://proandroiddev.com/why-service-locator-is-so-unpopular-bbe8678be72c\n\n\n##### DependencyManagerReflection\n\n\nIt uses the well known `@Inject` annotation,\n the injector will try to create automatically on every attribute \n with this annotation when the type has constructor without arguments.\n \nThis solution was created for simple integration testes, but can be used in large project.\n \n \n#### Examples\n\nExamples of how to use (Reflection version).\n\n\n```java\npublic class ServiceExample {\n\n    @Inject\n    private ServiceToInject serviceToInject;\n    private String injectByRule;\n}\n```\n\n\n```java\npublic class ServiceToInject {\n    public int foo() {\n        return 1 + 1;\n    }\n}\n```\n\nCreates the instances automatically\n\n```java\npublic class DependencyManagerReflectionTest {\n    @Test\n    public void test() {\n        DependencyManagerReflection dependencyManager = new DependencyManagerReflection();\n\n        // Configure an injection rule exception\n        String existingInstance = \"existingInstance\";\n        dependencyManager.addRule(\"injectByRule\", String.class, existingInstance);\n        \n        ServiceExample serviceExample = dependencyManager.get(ServiceExample.class);\n        \n        assertEquals(\"must call the method of injected class\", 2, serviceExample.callFoo());\n        assertSame(\"must be same instance\", existingInstance, serviceExample.getInjectByRule());\n    }    \n}\n```\n\n\nPlease, see the unit tests of this project for more examples:\n\nhttps://github.com/GustavoHennig/SimpleDependencyManager/tree/master/src/test/java/simpledependecymanager\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustavohennig%2Fsimpledependencymanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgustavohennig%2Fsimpledependencymanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustavohennig%2Fsimpledependencymanager/lists"}