登录 注册
内容创作与媒体工具AI 模型与开发框架自动化与工作流 androidcomposecompose-desktopinjectionkodeinkodein-di
3,335
Stars
177
Forks
46
Watchers
7
Open Issues
MIT
许可证
Kotlin
语言
2015-04-16
创建时间
2026-11-03
最近更新

项目能做什么

轻量易用的 Kotlin 依赖注入(DI)框架。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
> [!IMPORTANT]
> ## Kodein DI is now in maintenance mode
>
> **Kodein DI will no longer receive new features.** We will keep maintaining the current version and fix issues when necessary, but nothing more.
>
> ### What we are focusing on: Inara
>
> Our focus is now on [**Inara**](https://github.com/kosi-libs/Inara), a Kotlin Symbol Processor that brings compile-time dependency injection to Kotlin Multiplatform, with no runtime overhead.
>
> - 📖 [Inara documentation](https://kosi-libs.org/inara)
> - ✍️ [Read the announcement: Inara: Inject your dependencies at compile time](https://kodein-koders.com/en/blog/inara-inject-your-dependencies-at-compile-time/)
>
> ### Moving to Koin
>
> If you like how Kodein works, we warmly encourage you to migrate to [Koin](https://insert-koin.io). It supports everything Kodein does, and much more. See [Introducing the Koin migration skills](https://blog.insert-koin.io/introducing-the-koin-migration-skills-0b4be9c819cc) to get started.
> 

[![Maven Central](https://img.shields.io/maven-central/v/org.kodein.di/kodein-di)](https://mvnrepository.com/artifact/org.kodein.di/kodein-di)
[![Kotlin](https://img.shields.io/badge/Kotlin-1.9.21-blue.svg?style=flat&logo=kotlin)](https://kotlinlang.org)
![Github Actions](https://github.com/kosi-libs/Kodein/actions/workflows/snapshot.yml/badge.svg)
[![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/kosi-libs/Kodein/blob/master/LICENSE.txt)
[![Slack channel](https://img.shields.io/badge/Chat-Slack-green.svg?style=flat&logo=slack)](https://kotlinlang.slack.com/messages/kodein/)

KOtlin DEpendency INjection
===========================

**_KODEIN_** is a straightforward and yet very useful dependency retrieval container. it is effortless to use and configure.

**_KODEIN_** works on all Kotlin Multiplatform targets:

- JVM / Android.
- all Native platforms (iOS, macOS, Linux, Windows, WebAssembly).
- Javascript / WasmJs.

**_KODEIN_** allows you to:

- Lazily instantiate your dependencies when needed
- Stop caring about dependency initialization order
- Bind classes or interfaces to their instance or provider
- Debug your dependency bindings and recursions

**_KODEIN_** provides extensions to be integrable into:

- [Android](https://developer.android.com/)
- [Compose (Android / Desktop / Web)](https://kosi-libs.org/kodein/7.22/framework/compose.html)
- [Ktor](https://ktor.io/)

An example is always better than a thousand words:

```kotlin
val di = DI {
    bindProvider<Dice> { RandomDice(0, 5) }
    bindSingleton<DataSource> { SqliteDS.open("path/to/file") }
}

class Controller(private di: DI) {
    private val ds: DataSource by di.instance()
}
```

**_KODEIN_** is a good choice because:

- It proposes a very simple and readable declarative DSL
- It is not subject to type erasure (as Java is)
- It integrates nicely with Android
- It proposes a very kotlin-esque idiomatic API
- It is fast and optimized (makes extensive use of `inline`)

Installation
阅读完整原文

商业机会分析 AI 生成

Kodein 至 Koin/Inara 自动化迁移工具(CLI / IDE 插件)

产品构想官方明确鼓励用户迁移至 Koin 或转向 Inara。可开发一款基于 Kotlin 编译器前端或静态分析的自动化迁移工具,将 Kodein 的 DSL(如 bindProvider、bindSingleton、by di.instance())半自动转换为 Koin 或 Inara 语法。
核心功能Kodein 绑定语法解析、Koin/Inara 目标代码生成、依赖关系图比对与缺失检查、IntelliJ IDEA / Android Studio 插件集成。
目标用户代码库较大、手动迁移成本高的中大型 Android 或 Ktor 研发团队。
难度/周期中到高(需熟悉 Kotlin PSI/AST 及两种 DI 框架的语义差异) · 1-3 个月 · 成本:极低(主要为个人时间成本)
收费模式基础版免费引流,针对大型多模块项目的批量转换、定制规则及 CI 检查功能按项目或团队规模收费(推测)。
竞争风险Koin 官方已提及推出迁移技能/指南(Koin migration skills),可能自带免费官方工具导致第三方工具失去市场空间。
依据 AI推测

存量 Kodein 项目迁移与架构重构咨询服务

产品构想针对无法停机或缺乏人手重构的商业项目,提供按人天或按项目打包的“Kodein 剥离与 Koin/Inara 迁移”技术服务。
核心功能现有 DI 依赖图谱审计、分阶段平滑迁移方案设计、单元测试替身改造、团队内部培训。
目标用户依赖 Kodein 构建核心业务且有技术债清理需求的海外或国内企业团队(如 README 中提及的后端或移动端团队)。
难度/周期中(需要扎实的 Kotlin/KMP 实战与重构经验) · 随时可启动,单项目交付周期 2-6 周 · 成本:几乎为零
收费模式技术咨询费、外包重构固定报价。
竞争风险非标服务难以规模化;需验证当前市场上仍有足够多愿意为迁移付费的存量 Kodein 客户。
依据 尚需验证的假设

企业级长期支持(LTS)与定制化维护

产品构想由于项目已停止新特性开发且仅做必要修复,可为因历史原因(如锁死在旧版 Kotlin 1.8/1.9 或 JDK 1.8)无法升级或迁移的企业提供付费 SLA 支持与 Bug 反向移植。
核心功能新版本 Kotlin/Android 兼容性补丁反向移植、安全漏洞应急修复、专属技术支持响应。
目标用户对稳定性要求极高、技术栈升级周期极长的传统企业或大型商业软件团队。
难度/周期低到中(基于 MIT 协议 Fork 维护即可) · 长期持续 · 成本:极低
收费模式按年收取企业级技术支持订阅费(SLA)。
竞争风险Issue 数量极少(当前仅 7 个),说明社区维护压力或潜在痛点可能并不大,付费意愿存疑。
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
morluto/rea 中文介绍暂未生成
Reverse engineer anything with agents, from app behavior dow
453,132 TypeScript
flutter/flutter 中文介绍暂未生成
Flutter makes it easy and fast to build beautiful apps for m
181,239 Dart
Genymobile/scrcpy 中文介绍暂未生成
Display and control your Android device
154,610 C
rustdesk/rustdesk 中文介绍暂未生成
An open-source remote desktop application designed for self-
129,095 Rust
react/react-native 中文介绍暂未生成
A framework for building native applications using React
126,901 C++
Hack-with-Github/Awesome-Hacking 中文介绍暂未生成
A collection of various awesome lists for hackers, pentester
125,303 -
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2015-04-16,近 30 天仍在推送,发布过 47 个 Release
社区活跃Star 3,335 / Fork 177 / Issue 7(数据支持,可自行核实)
许可证MIT
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/kosi-libs/Kodein.git
cd Kodein
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。