fun myInterface(): MyInterface = MyImplementation()
}
----
======
======
In the example above, the declared type for the `myInterface` bean is `MyInterface`.
In the example above, the declared type for the `myInterface` bean is `MyInterface`.
@ -314,6 +327,19 @@ Java::
}
}
----
----
Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
@Configuration(proxyBeanMethods = false)
class UserConfiguration {
@Bean
fun myInterface() = MyImplementation()
}
----
======
======
If you are registering bean definitions programmatically, consider using `RootBeanBefinition` as it allows to specify a `ResolvableType` that handles generics.
If you are registering bean definitions programmatically, consider using `RootBeanBefinition` as it allows to specify a `ResolvableType` that handles generics.
@ -371,6 +397,15 @@ Java::
// ...
// ...
}
}
----
----
Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
class ClientFactoryBean<T : AbstractClient> : FactoryBean<T> {
// ...
}
----
======
======
A concrete client declaration should provide a resolved generic for the client, as shown in the following example:
A concrete client declaration should provide a resolved generic for the client, as shown in the following example:
@ -391,6 +426,19 @@ Java::
}
}
----
----
Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
@Configuration(proxyBeanMethods = false)
class UserConfiguration {
@Bean
fun myClient() = ClientFactoryBean<MyClient>(...)
}
----
======
======
If the `FactoryBean` bean definition is registered programmatically, make sure to follow these steps:
If the `FactoryBean` bean definition is registered programmatically, make sure to follow these steps: