{"id":13485742,"url":"https://github.com/vanillasource/jaywire","last_synced_at":"2026-01-11T07:46:12.337Z","repository":{"id":26996803,"uuid":"30460755","full_name":"vanillasource/jaywire","owner":"vanillasource","description":"JayWire Dependency Injection","archived":false,"fork":false,"pushed_at":"2023-02-21T02:56:18.000Z","size":269,"stargazers_count":57,"open_issues_count":3,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-21T09:39:16.121Z","etag":null,"topics":["dependency-injection","di","java","jaywire-dependency-injection"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanillasource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-02-07T15:59:43.000Z","updated_at":"2024-11-10T20:14:05.000Z","dependencies_parsed_at":"2024-01-03T01:20:57.503Z","dependency_job_id":"09ad4064-3436-4f7f-809d-cda25b0f81b8","html_url":"https://github.com/vanillasource/jaywire","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillasource%2Fjaywire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillasource%2Fjaywire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillasource%2Fjaywire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanillasource%2Fjaywire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanillasource","download_url":"https://codeload.github.com/vanillasource/jaywire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245910890,"owners_count":20692514,"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","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","di","java","jaywire-dependency-injection"],"created_at":"2024-07-31T18:00:30.989Z","updated_at":"2026-01-11T07:46:12.268Z","avatar_url":"https://github.com/vanillasource.png","language":"Java","readme":"![Build Status](https://img.shields.io/travis/vanillasource/jaywire.svg)\n![Published Version](https://img.shields.io/maven-central/v/com.vanillasource.jaywire/jaywire-parent.svg)\n[![Join the chat at https://gitter.im/vanillasource/jaywire](https://badges.gitter.im/vanillasource/jaywire.svg)](https://gitter.im/vanillasource/jaywire?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nJayWire Dependency Injection\n============================\n\nA very small and lightweight dependency injection framework for Java 8 without magic. Main features are:\n\n* 100% pure Java code (no XML, no config files)\n* Explicit, compile-time wireing\n* Typesafe\n* Modular and extendable\n* Small and easy\n\nJayWire avoids any magic, that means:\n\n* No classpath scanning\n* No reflection\n* No annotations\n* No bytecode enhancement / weaving\n* No transparent proxies\n* No code generation\n* No hidden / static state\n\n### Getting the library\n\nAdd this dependency to your Maven build:\n\n```xml\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.vanillasource.jaywire\u003c/groupId\u003e\n   \u003cartifactId\u003ejaywire\u003c/artifactId\u003e\n   \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nThis will include the basic interfaces and scopes for standalone usage. \nFor integration with Web-frameworks see Wiki.\n\n### Wireing everything together\n\nFor a simple application a single \"Module\" object wireing everything together is written this way:\n\n```java\nimport com.vanillasource.jaywire.standalone.StandaloneModule;\n\npublic class MyAppModule extends StandaloneModule {\n   public Database getDatabase() {\n      return singleton(() -\u003e new MyAppDatabase(...));\n   }\n\n   public ServiceA getServiceA() {\n      return singleton(() -\u003e new ServiceA(getDatabase()));\n   }\n\n   public ServiceB getServiceB() {\n      return singleton(() -\u003e new ServiceB(getDatabase(), getServiceA());\n   }\n}\n```\n\nIn this example there is a Database, ServiceA and ServiceB, all of them singletons. It is assumed\nthat these services / classes are written in the usual Object-Oriented approach by taking all required\ndependencies as constructor parameters.\nThese dependencies are then \"injected\" by simply calling the appropriate methods to get fully constructed\ndependencies and supplying them as parameters to objects.\n\nYou can use the _MyAppModule_ then at the \"top\" of your application to start processing:\n\n```java\npublic class MyApp {\n   public static final void main(String[] argv) {\n      MyAppModule module = new MyAppModule();\n      module.getServiceB().run();\n   }\n}\n```\n\n### Documentation\n\nThe JayWire [API Documentation](http://vanillasource.github.io/jaywire/apidocs/).\n\nPlease visit the [JayWire Wiki](https://github.com/vanillasource/jaywire/wiki) for more information.\n\n### Related external projects\n\n * [Pouch](https://bitbucket.org/cowwoc/pouch/) is an interesting rethinking of the Service Locator pattern.\n","funding_links":[],"categories":["Projects","项目","IoC"],"sub_categories":["Dependency Injection","依赖注入"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanillasource%2Fjaywire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanillasource%2Fjaywire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanillasource%2Fjaywire/lists"}