Ir al contenido

Service Locator (ARCH8198)

Esta página aún no está disponible en tu idioma.

Key kotlin.quality.service-locator · Severity warning · Category quality

Flags services resolved at runtime from a container (applicationContext.getBean, Koin get() / inject() inside functions) instead of constructor injection.

class Svc { fun run() { val repo = ctx.getBean(Repo::class.java) } }
class Svc(private val repo: Repo) { fun run() = repo.load() }

Inject the dependency through the constructor.