You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: framework-docs/modules/ROOT/pages/core/aot.adoc
+97Lines changed: 97 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,19 @@ Java::
290
290
291
291
}
292
292
----
293
+
294
+
Kotlin::
295
+
+
296
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
297
+
----
298
+
@Configuration(proxyBeanMethods = false)
299
+
class UserConfiguration {
300
+
301
+
@Bean
302
+
fun myInterface(): MyInterface = MyImplementation()
303
+
304
+
}
305
+
----
293
306
======
294
307
295
308
In the example above, the declared type for the `myInterface` bean is `MyInterface`.
@@ -314,6 +327,19 @@ Java::
314
327
315
328
}
316
329
----
330
+
331
+
Kotlin::
332
+
+
333
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
334
+
----
335
+
@Configuration(proxyBeanMethods = false)
336
+
class UserConfiguration {
337
+
338
+
@Bean
339
+
fun myInterface() = MyImplementation()
340
+
341
+
}
342
+
----
317
343
======
318
344
319
345
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::
371
397
// ...
372
398
}
373
399
----
400
+
401
+
Kotlin::
402
+
+
403
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
404
+
----
405
+
class ClientFactoryBean<T : AbstractClient> : FactoryBean<T> {
406
+
// ...
407
+
}
408
+
----
374
409
======
375
410
376
411
A concrete client declaration should provide a resolved generic for the client, as shown in the following example:
@@ -391,6 +426,19 @@ Java::
391
426
392
427
}
393
428
----
429
+
430
+
Kotlin::
431
+
+
432
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
433
+
----
434
+
@Configuration(proxyBeanMethods = false)
435
+
class UserConfiguration {
436
+
437
+
@Bean
438
+
fun myClient() = ClientFactoryBean<MyClient>(...)
439
+
440
+
}
441
+
----
394
442
======
395
443
396
444
If the `FactoryBean` bean definition is registered programmatically, make sure to follow these steps:
0 commit comments