{"id":49815462,"url":"https://github.com/luqinx/sp","last_synced_at":"2026-05-29T21:00:50.153Z","repository":{"id":43764337,"uuid":"195253694","full_name":"luqinx/sp","owner":"luqinx","description":"sp(a)是一个SPI(Service Provider Interface)框架, 他具有跨模块(无任何依赖关系的模块)创建对象的能力。使用简单、功能强大、性能损耗极低，是组件化开发、模块解耦合的不二之选。由于sp(a)灵活的配置能力，使得它很容易扩展出更多的跨模块通信能力，如组件热插拔、路由、事件分发、rpc通信等。如果您正在使用组件化开发，或者您有多项目需要做差异化处理，强烈推荐您使用sp(a)。","archived":false,"fork":false,"pushed_at":"2023-09-10T02:34:55.000Z","size":901,"stargazers_count":111,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-11-07T22:10:38.390Z","etag":null,"topics":["android","componentization","java"],"latest_commit_sha":null,"homepage":"","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/luqinx.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","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":"2019-07-04T14:10:39.000Z","updated_at":"2023-09-04T06:32:37.000Z","dependencies_parsed_at":"2022-08-21T20:00:35.149Z","dependency_job_id":null,"html_url":"https://github.com/luqinx/sp","commit_stats":null,"previous_names":[],"tags_count":7,"template":null,"template_full_name":null,"purl":"pkg:github/luqinx/sp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqinx%2Fsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqinx%2Fsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqinx%2Fsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqinx%2Fsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luqinx","download_url":"https://codeload.github.com/luqinx/sp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luqinx%2Fsp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33670211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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":["android","componentization","java"],"created_at":"2026-05-13T06:00:43.974Z","updated_at":"2026-05-29T21:00:50.143Z","avatar_url":"https://github.com/luqinx.png","language":"Java","funding_links":[],"categories":["开发框架"],"sub_categories":["RPC框架"],"readme":"# ServicePool\n\n[![GitHub license](https://img.shields.io/github/license/luqinx/sp)](https://github.com/luqinx/sp/blob/master/LICENSE)\n[![build release](https://img.shields.io/badge/release-1.7.0-brightgreen)](https://search.maven.org/search?q=io.github.luqinx)\n[![掘金](https://img.shields.io/badge/docs-%E6%8E%98%E9%87%91-orange)](https://juejin.cn/post/6995144994180825119)\n\n### ServicePool接入方法\n\nspa已迁移至mavenCentral, groupId已修正为io.github.luqinx, 包名还保持原来的包名\n\n在项目根目录的build.gradle中引入 \n\n```\nallprojects {\n    repositories {\n        ...\n        mavenCentral()\n    }\n}\n```\n\n和\n \n```\nbuildscript {\n\n    repositories {\n        ...\n        mavenCentral()\n    }\n    dependencies {\n        ...\n        classpath 'io.github.luqinx:autoservice:1.7.0'\n    }\n}\n```\n\n在主Module目录(一般是app目录)的build.gradle中添加 \n\n```\napply plugin: 'sp.autoservice'\n\n...\n```\n\n** 其他Module下按需添加依赖 **\n```\ndependencies {\n    implementation 'io.github.luqinx:sp:1.7.0' //servicepool核心库, 是java库, 非android环境用这个就可以了\n    implementation 'io.github.luqinx:spa:1.7.0' // servicepool的Android支持(spa), 只依赖spa也是可以的\n    implementation 'io.github.luqinx:sprouter:1.7.0' // 基于spa的页面路由\n}\n```\n\n** 混淆配置 **\n\n```\n\n-ignorewarnings\n\n-dontwarn com.google.common.**\n\n-dontwarn net.bytebuddy.**\n\n-keep class net.bytebuddy.** {*;}\n-keep class com.android.** {*;}\n\n-keep @chao.java.tools.servicepool.annotation.* class *\n-keep @chao.android.tools.rpc.annotation.* class ** {*;}\n\n-keep class chao.android.tools.** {*;}\n-keep class chao.java.tools.** {*;}\n\n```\n\n### ServicePool使用方式\n\n#### 在Application的onCreate()/onAttachBaseContext()方法中初始化 \nServicePool使用懒加载思想,所有服务Service对象都是在真正使用的时刻才会去创建和初始化。这里主要是因为Android部分功能依赖Context，\n初始化时可注入ApplicationContext。还有有些特定的服务有预加载的需求(如业务组件可能需要一个特定的初始化场景，而不是去依赖Application的onCreate()方法)\n\n```\n   Spa.init(this); //初始化耗时10ms左右, 设备不同可能会有些差异, 我测试的设备是小米mix3\n```\n\nSpa的更多使用细节，请参考博客[Android端简单易用的SPI框架 - SPA](https://juejin.im/post/6872335132229894158)\n\n\n\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluqinx%2Fsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluqinx%2Fsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluqinx%2Fsp/lists"}