JetBrains clarifies dependency injection plans for Ktor

Ktor will never require the use of a DI framework or include a DI framework as part of its design, JetBrains said.

Takeoff plane in airport    166183750
Thinkstock

JetBrains has cleared up confusion over its plans for dependency injection (DI) support in Ktor, which it revealed last week in its 2024 roadmap for the Kotlin-based framework. The company is now assuring users that there will be no requirement to use a DI framework with Ktor.

In a Kotlin blog post published March 18, Garth Gilmour, JetBrains’ developer advocate, said a lot of questions have arisen regarding DI since the roadmap was published on March 12. Users have questioned how Ktor will be changed to support DI and integrate existing DI frameworks. Ktor allows developers to build asynchronous server-side and client-side applications using Kotlin

Gilmour stressed that Ktor will never require the use of a DI framework or include a DI framework as part of its design. “The proposed feature is solely for users who wish to combine DI with their Ktor services,” he said. The company wants to help existing DI frameworks integrate with Ktor as seamlessly as possible. DI will be completely optional and users will be able to use the DI framework’s native syntax if they prefer.

“Our goal is to radically simplify how DI is used within Ktor, without adding any extra complexity,” Gilmour said. Plans call for users to be able to select which DI framework, if any, they want to use in the Ktor Project Generator. Support is eyed for all DI frameworks. Then the Ktor Gradle plugin will automatically find all components managed by that framework.

Copyright © 2024 IDG Communications, Inc.