@@ -31,10 +31,9 @@ https://start.spring.io/#!language=kotlin[start.spring.io].
31
31
[[extensions]]
32
32
== Extensions
33
33
34
- Thanks to its great https://kotlinlang.org/docs/reference/java-interop.html[Java interoperability]
35
- and to https://kotlinlang.org/docs/reference/extensions.html[Kotlin extensions], Spring
36
- Framework Kotlin APIs leverage regular Java APIs and are additionally enhanced by a few Kotlin specific APIs
37
- available out of the box within Spring Framework 5 artifacts.
34
+ Kotlin https://kotlinlang.org/docs/reference/extensions.html[extensions] provide the ability
35
+ to extend existing classes with additional functionality. The Spring Framework Kotlin APIs make
36
+ use of these extensions to add new Kotlin specific conveniences to existing Spring APIs.
38
37
39
38
{doc-root}/spring-framework/docs/{spring-version}/kdoc-api/spring-framework/[Spring Framework KDoc API] lists
40
39
and documents all the Kotlin extensions and DSLs available.
@@ -343,11 +342,11 @@ Whilst Kotlin's JVM-friendly design is generally frictionless with Spring,
343
342
this specific Kotlin feature can prevent the application from starting, if this fact is not taken in
344
343
consideration. This is because Spring beans are normally proxified with CGLIB
345
344
- such as `@Configuration` classes - which need to be inherited at runtime for technical reasons.
345
+ The workaround was to add an `open` keyword on each class and member
346
+ functions of Spring beans proxified with CGLIB such as `@Configuration` classes, which can
347
+ quickly become painful and is against Kotlin principle to keep code concise and predictable.
346
348
347
- Before Kotlin 1.0.6, one needed to add an `open` keyword on each class and member
348
- functions of Spring beans proxified with CGLIB such as `@Configuration` classes.
349
-
350
- Fortunately, Kotlin 1.0.6+ now provides a
349
+ Fortunately, Kotlin now provides a
351
350
https://kotlinlang.org/docs/reference/compiler-plugins.html#kotlin-spring-compiler-plugin[`kotlin-spring`]
352
351
plugin, a preconfigured version of `kotlin-allopen` plugin that automatically opens classes
353
352
and their member functions for types annotated or meta-annotated with one of the following
@@ -362,7 +361,8 @@ Meta-annotations support means that types annotated with `@Configuration`, `@Con
362
361
`@RestController`, `@Service` or `@Repository` are automatically opened since these
363
362
annotations are meta-annotated with `@Component`.
364
363
365
- http://start.spring.io/#!language=kotlin[start.spring.io] enables it by default.
364
+ http://start.spring.io/#!language=kotlin[start.spring.io] enables it by default, so in practice
365
+ you will be able to write your Kotlin beans without any additional `open` keyword, like in Java.
366
366
367
367
=== Using immutable class instances for persistence
368
368
0 commit comments