gradle
8.6

# registerBinding

abstract fun <U : T?> registerBinding(type: Class<U>, implementationType: Class<out U>)(source)

Registers a binding from the specified "public" domain object type to the specified implementation type. Whenever the container is asked to create an element with the binding's public type, it will instantiate the binding's implementation type. If the implementation type has a constructor annotated with javax.inject.Inject, its arguments will be injected.

The implementation type may also be an interface that has a read-only `name` property of type String, and is otherwise empty or consists entirely of managed properties.

In general, registering a binding is preferable over implementing and registering a factory.

#### Parameters

type

a public domain object type

implementationType

the corresponding implementation type

<U>

a public domain object type