optional

open fun <T : Any> optional(what: Identifier<T>): Injector<T?>

Create an injector for the given identifier. If such an identifier cannot be found within the environment, returns null (unlike inject which throws a ComponentNotFoundException).

The default implementation only catches ComponentNotFoundExceptions that are thrown by the underlying inject call.