-
Notifications
You must be signed in to change notification settings - Fork 27
feat(ktor-starter): add Koin DI integration #256
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
base: main
Are you sure you want to change the base?
Conversation
| | || || || || || || || || | | ||
| | || || || || || || || || | | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| GraphQL Data Pipeline Framework |
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.
I don't know if i like "Data Pipeline Framework" -- how about "Data-Oriented Service Mesh"?
|
|
||
| dependencyResolutionManagement { | ||
| repositories { | ||
| mavenLocal() |
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.
i don't think we should check this in.
| response.status shouldBe HttpStatusCode.OK | ||
| // Verify we get ASCII art data (contains GraphQL framework text) | ||
| val body = response.bodyAsText() | ||
| body.contains("GraphQL Data Pipeline Framework") shouldBe true |
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.
change here too if you change it.
deec9e6 to
81a1337
Compare
Add a new demo application demonstrating Micronaut integration with Viaduct's serve module. Key features: - MicronautServerProvider: Starts only Micronaut's ApplicationContext (DI container) without the HTTP server for fast development iteration - MicronautTenantCodeInjector: Bridges Micronaut DI with Viaduct resolvers - ViaductConfiguration: Factory for creating Viaduct bean with DI support This enables fast startup times during development by avoiding full Micronaut HTTP server initialization while still providing full dependency injection for resolvers. Structure: - serve/MicronautServerProvider.kt - ViaductServer integration - injector/ViaductConfiguration.kt - Viaduct bean factory - injector/MicronautTenantCodeInjector.kt - DI bridge - resolvers/ - Sample resolver implementations
…startup Use ApplicationContext.builder().packages() to limit Micronaut's classpath scanning to only the necessary packages: - com.example.viadapp.injector (ViaductConfiguration, TenantCodeInjector) - com.example.viadapp.resolvers (Resolver implementations) This avoids loading controllers, filters, HTTP server components, and other beans that aren't needed for serve mode, resulting in faster startup times.
Move serve runtime code from gradle-plugins/application-plugin to a standalone serve/ module that publishes com.airbnb.viaduct:serve artifact. This enables micronaut-starter and other apps to depend on the serve runtime classes (ViaductServerProvider, ViaductServerConfiguration) when building in isolation with mavenLocal. - Create serve/ module with viaduct-publishing convention - Move serve source and test files from application-plugin - Update application-plugin to depend on libs.viaduct.serve - Add serve module to included-builds/core/settings.gradle.kts - Add dependency substitution in root settings.gradle.kts - Update micronaut-starter to use mavenLocal and correct version
- Rename ViaductServerProvider interface to ViaductProvider - Rename MicronautServerProvider to MicronautViaductProvider - Reorganize micronaut-starter with dev/production source sets: - Production code in src/main/kotlin/.../production/ - Dev-only code in src/dev/kotlin/.../dev/ - viaduct-serve dependency only included in dev builds - Update version to 0.16.0-SNAPSHOT - Add micronaut-starter to version sync scripts and tests - Update documentation with new structure and build configuration
…ector Implements Koin-based dependency injection for the ktor-starter demo app, demonstrating how to use a DI framework as the source of truth for resolver discovery and instantiation (analogous to Spring in starwars demo). Key components: - KoinTenantCodeInjector: implements TenantCodeInjector, delegates to Koin - KoinTenantResolverClassFinder: returns resolvers from explicit set (no scanning) - KoinTenantResolverClassFinderFactory: creates finders for packages - viaductModule: registers Viaduct singleton configured with Koin-based DI - resolversModule: registers services and resolver factories - resolverClasses set: explicit registry for resolver discovery Example implementation: - AsciiArtService: loads ASCII art from resources - AsciiArtResolver: uses constructor injection via Koin - asciiArt query in GraphQL schema To add a new resolver: 1. Add class to resolverClasses set 2. Register as factory in resolversModule
Remove KoinTenantResolverClassFinder and KoinTenantResolverClassFinderFactory. Use Viaduct's default classpath scanning for resolver discovery. Koin is now only used for instantiation via KoinTenantCodeInjector, which enables constructor injection of dependencies into resolvers.
Register Koin instance itself in the module so it can be injected. Use get() for all dependency injection rather than explicit getKoin() calls.
- Change tagline to "Data-Oriented Service Mesh" - Remove mavenLocal() from repository configurations
Remove property-based injection that caused JVM signature clash between the generated getter and the interface method getViaduct().
6da9289 to
cf67faa
Compare
Summary
PUBLIC
feat(ktor-starter): add Koin DI integration with custom TenantCodeInjector
Implements Koin-based dependency injection for the ktor-starter demo app, demonstrating how to use a DI framework as the source of truth for resolver instantiation.
Key components:
Test Plan
./gradlew buildsucceeds for ktor-starter./gradlew buildsucceeds for micronaut-starter