onInvalidScope

open fun <T : Any, PutParams> onInvalidScope(key: ServiceKey<T, *, *, PutParams>, putParams: PutParams): ServiceEntry<T>

Called when getOrProvide is attempted for a key in a disallowed scope.

The default behavior is to throw a ServiceLocatorException. Subclasses can override this to provide a mock or other fallback instance.

Return

A ServiceEntry to be used as a fallback.

Parameters

key

The ServiceKey for which the provision was attempted.

putParams

The original parameters that would have been used for registration.