{"id":20509796,"url":"https://github.com/goldengamerlp/dependencyloader","last_synced_at":"2025-08-26T23:38:53.568Z","repository":{"id":178411974,"uuid":"653321479","full_name":"GoldenGamerLP/DependencyLoader","owner":"GoldenGamerLP","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-20T20:15:11.000Z","size":451,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T22:30:21.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/GoldenGamerLP.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":"2023-06-13T20:44:52.000Z","updated_at":"2023-07-03T19:10:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"c07fd016-1033-465c-b7ab-ca8b7b512a16","html_url":"https://github.com/GoldenGamerLP/DependencyLoader","commit_stats":null,"previous_names":["goldengamerlp/dependencyloader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GoldenGamerLP/DependencyLoader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldenGamerLP%2FDependencyLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldenGamerLP%2FDependencyLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldenGamerLP%2FDependencyLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldenGamerLP%2FDependencyLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoldenGamerLP","download_url":"https://codeload.github.com/GoldenGamerLP/DependencyLoader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoldenGamerLP%2FDependencyLoader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272267871,"owners_count":24903791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-15T20:26:29.930Z","updated_at":"2025-08-26T23:38:53.533Z","avatar_url":"https://github.com/GoldenGamerLP.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CodeFactor](https://www.codefactor.io/repository/github/goldengamerlp/dependencyloader/badge)](https://www.codefactor.io/repository/github/goldengamerlp/dependencyloader) [![](https://jitpack.io/v/GoldenGamerLP/DependencyLoader.svg)](https://jitpack.io/#GoldenGamerLP/DependencyLoader)\n\n# Simple Automatic Dependency Loader for Java\n\n## What is DPL?\n\nDPL is a simple dependency loader for Java. DPL allows you to load dependencies (Classes) automatically without needing\nto\nimport them by using annotations. It is very useful for large projects and even small projects by making your life\neasier and doing the hard work, loading dependencies, injecting dependencies, running methods and ordering dependencies.\nI made this project because other injection libraries were too complicated for a simple project, so I started DPL.\n\n## How to use DPL?\n\nDPL is easy 2 use. DPL mainly uses annotations. No need to register classes or running methods by yourself.\n\n### Different Annotations Explained:\n\n- **@AutoLoadable**: This annotation is used to mark a class as a dependency. This class will be loaded automatically.\n  No need to register anything.\n- **@DependencyConstructor**: This annotation is used to mark a constructor as a dependency constructor. This\n  constructor will be used to create an instance of the class. *\n  *_The parameters of the constructor are later used for ordering dependencies._**\n- **@AutoRun**: This annotation is used to mark any method, without a return value or parameter to be run automatically.\n  You can specify in the annotation if the method should be run async and with which priority.\n- **@Inject**: This annotation is used to mark a field as being injected. The field will be set to the instance of the\n  specified class. _**This class is later used for dependency ordering.**_\n\n## Example\n\n```java\npublic class Main {\n\n    public static void main(String[] args) {\n        DependencyLoader dependencyLoader = DependencyLoader.getInstance();\n        \n        //Add a standalone dependency which cant be loaded by annotations\n        dependencyLoader.addDependency(new MyStandaloneClass());\n        \n        //Load dependencies and let DPL do the hard work\n        dependencyLoader.init();\n    }\n    \n   //Marks this class as a dependency and loads it automatically\n    @AutoLoadable\n    public static class MyAutoLoadClass {\n    \n        //Injects the instance of MyStandaloneClass into this field\n        @Inject\n        private MyStandaloneClass myStandaloneClass;\n    \n        //Marks this constructor as a dependency constructor. All parameters are used for ordering dependencies. \n        //Make sure that every parameter is either added as a standalone dependency or is able to be loaded by annotations.\n        @DependencyConstructor\n        public MyAutoLoadClass() {\n            System.out.println(\"MyAutoLoadClass was loaded automatically\");\n        }\n        \n        //Run this method automatically and async with priority 1\n        @AutoRun(priority = 1, async = true)\n        public void run() {\n            System.out.println(\"MyAutoLoadClass was run automatically\");\n        }\n    }\n}\n```\n\n## Dependency Ordering\n\nDPL uses dependency ordering to make sure that all dependencies are loaded in the correct order.\nDPL uses the **parameters** of the dependency constructor and the **injected fields** to order dependencies.\n\n## Remarks and Limitations\n\n- DPL cannot load dependencies without @AutoLoadable and @DependencyConstructor.\n- Cyclic dependencies are not supported.\n- AutoRun methods are not allowed to have parameters or a return value.\n\n## How to use DPL in your project\n\n### 1. Add Jitpack as a Repository\n\n- Maven:\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io/\u003c/url\u003e \n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n- Gradle:\n\n```groovy\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\n```\n\n### 2. Add DependencyLoader and the AnnotationProcessor as a Dependency\n\n- Maven:\n\n```xml\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.GoldenGamerLP\u003c/groupId\u003e\n        \u003cartifactId\u003eDependencyLoader\u003c/artifactId\u003e\n        \u003cversion\u003e-SNAPSHOT\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.GoldenGamerLP\u003c/groupId\u003e\n        \u003cartifactId\u003eDependencyLoader-AnnotationProcessor\u003c/artifactId\u003e\n        \u003cversion\u003e-SNAPSHOT\u003c/version\u003e\n        \u003cscope\u003eprovided\u003c/scope\u003e\n        \u003coptional\u003etrue\u003c/optional\u003e\n        \u003cexclusions\u003e\n        \u003cexclusion\u003e\n          \u003cgroupId\u003ecom.github.GoldenGamerLP\u003c/groupId\u003e\n          \u003cartifactId\u003eDependencyExamples\u003c/artifactId\u003e\n        \u003c/exclusion\u003e\n      \u003c/exclusions\u003e \n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n- Gradle:\n\n```groovy\ndependencies {\n    implementation ('com.github.GoldenGamerLP:DependencyLoader:-SNAPSHOT') {\n      exclude module: 'DependencyExamples'\n    }\n    annotationProcessor 'com.github.GoldenGamerLP:DependencyLoader-AnnotationProcessor:-SNAPSHOT'\n}\n```\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\nDPL is licensed under the MIT License. See [MIT License Website](https://opensource.org/license/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoldengamerlp%2Fdependencyloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoldengamerlp%2Fdependencyloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoldengamerlp%2Fdependencyloader/lists"}