-
Notifications
You must be signed in to change notification settings - Fork 17
feat(#821): ktor works with any dependency provider, and also with ktor-di with auto detection #937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…or-di with auto detection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds flexible dependency injection support to Stove's Ktor testing module, allowing it to work with Koin, Ktor-DI, or custom DI frameworks. Previously, only Koin was supported. The implementation uses auto-detection based on classpath availability and provides an extensibility point for custom resolvers.
Key Changes:
- Introduced DI abstraction layer with
DependencyResolvertype alias andDependencyResolversobject for auto-detection - Made Koin and Ktor-DI
compileOnlydependencies to allow users to bring their preferred DI system - Created shared test fixtures and separate test modules for both Koin and Ktor-DI to validate the implementation
Reviewed changes
Copilot reviewed 19 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| starters/ktor/stove-ktor-testing-e2e/src/main/kotlin/com/trendyol/stove/testing/e2e/DependencyResolvers.kt | New file defining resolver abstraction and implementations for Koin, Ktor-DI, and auto-detection |
| starters/ktor/stove-ktor-testing-e2e/src/main/kotlin/com/trendyol/stove/testing/e2e/KtorDiCheck.kt | New utility for runtime classpath detection of DI frameworks |
| starters/ktor/stove-ktor-testing-e2e/src/main/kotlin/com/trendyol/stove/testing/e2e/KtorBridgeSystem.kt | Updated to accept custom resolver with default auto-detection |
| starters/ktor/stove-ktor-testing-e2e/build.gradle.kts | Changed Koin and Ktor-DI dependencies from implementation to compileOnly |
| starters/ktor/tests/ktor-test-fixtures/* | New shared test fixtures module with common test domain and abstract test class |
| starters/ktor/tests/ktor-koin-tests/* | New test module demonstrating Koin integration |
| starters/ktor/tests/ktor-di-tests/* | New test module demonstrating Ktor-DI integration |
| settings.gradle.kts | Added three new test modules to the build |
| gradle/libs.versions.toml | Added ktor-server-di library reference |
| docs/release-notes/0.20.0.md | Documented the new DI flexibility feature with usage examples |
| build.gradle.kts | Excluded new test modules from API validation |
| starters/ktor/stove-ktor-testing-e2e/api/stove-ktor-testing-e2e.api | Updated API signatures to reflect new resolver parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stove-ktor-testing-e2e/src/main/kotlin/com/trendyol/stove/testing/e2e/DependencyResolvers.kt
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #937 +/- ##
==========================================
+ Coverage 78.56% 78.65% +0.09%
==========================================
Files 117 121 +4
Lines 3848 3926 +78
Branches 323 329 +6
==========================================
+ Hits 3023 3088 +65
- Misses 631 640 +9
- Partials 194 198 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
553b01c to
3d1fb6f
Compare
implements #821