diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/bean-definition-dsl.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/bean-definition-dsl.adoc index 53ee46dd29c6..c2c2b9f246da 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/bean-definition-dsl.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/bean-definition-dsl.adoc @@ -107,7 +107,7 @@ NOTE: Spring Boot is based on JavaConfig and {spring-boot-issues}/8115[does not yet provide specific support for functional bean definition], but you can experimentally use functional bean definitions through Spring Boot's `ApplicationContextInitializer` support. See {stackoverflow-questions}/45935931/how-to-use-functional-bean-definition-kotlin-dsl-with-spring-boot-and-spring-w/46033685#46033685[this Stack Overflow answer] -for more details and up-to-date information. See also the experimental Kofu DSL developed in {spring-github-org}/spring-fu[Spring Fu incubator]. +for more details and up-to-date information. See also the experimental Kofu DSL developed in {spring-github-org}-experimental/spring-fu[Spring Fu incubator]. diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/coroutines.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/coroutines.adoc index edca977e236a..913acb052e71 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/coroutines.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/coroutines.adoc @@ -17,6 +17,7 @@ Spring Framework provides support for Coroutines on the following scope: * WebFlux {spring-framework-api-kdoc}/spring-web/org.springframework.web.server/-co-web-filter/index.html[`CoWebFilter`] * Suspending function and `Flow` support in RSocket `@MessageMapping` annotated methods * Extensions for {spring-framework-api-kdoc}/spring-messaging/org.springframework.messaging.rsocket/index.html[`RSocketRequester`] +* Spring AOP diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/getting-started.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/getting-started.adoc index 26cf9aa412b6..6b8b75b491ec 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/getting-started.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/getting-started.adoc @@ -10,22 +10,21 @@ The easiest way to learn how to build a Spring application with Kotlin is to fol == `start.spring.io` The easiest way to start a new Spring Framework project in Kotlin is to create a new Spring -Boot 2 project on https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io]. +Boot project on https://start.spring.io/#!language=kotlin&type=gradle-project-kotlin[start.spring.io]. [[choosing-the-web-flavor]] == Choosing the Web Flavor -Spring Framework now comes with two different web stacks: xref:web/webmvc.adoc#mvc[Spring MVC] and +Spring Framework comes with two different web stacks: xref:web/webmvc.adoc#mvc[Spring MVC] and xref:testing/unit.adoc#mock-objects-web-reactive[Spring WebFlux]. Spring WebFlux is recommended if you want to create applications that will deal with latency, -long-lived connections, streaming scenarios or if you want to use the web functional -Kotlin DSL. +long-lived connections or streaming scenarios. For other use cases, especially if you are using blocking technologies such as JPA, Spring -MVC and its annotation-based programming model is the recommended choice. +MVC is the recommended choice. diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/requirements.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/requirements.adoc index 19c0ae9e38bb..d2b3657d3127 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/requirements.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/requirements.adoc @@ -2,15 +2,12 @@ = Requirements :page-section-summary-toc: 1 -Spring Framework supports Kotlin 1.3+ and requires +Spring Framework supports Kotlin 1.7+ and requires https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-stdlib[`kotlin-stdlib`] -(or one of its variants, such as https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-stdlib-jdk8[`kotlin-stdlib-jdk8`]) and https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-reflect[`kotlin-reflect`] to be present on the classpath. They are provided by default if you bootstrap a Kotlin project on https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io]. -WARNING: Kotlin {kotlin-docs}/inline-classes.html[inline classes] are not yet supported. - NOTE: The {jackson-github-org}/jackson-module-kotlin[Jackson Kotlin module] is required for serializing or deserializing JSON data for Kotlin classes with Jackson, so make sure to add the `com.fasterxml.jackson.module:jackson-module-kotlin` dependency to your project if you have such need. diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/resources.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/resources.adoc index 567719b78dca..f3be082c275a 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/resources.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/resources.adoc @@ -18,28 +18,9 @@ Kotlin and the Spring Framework: The following Github projects offer examples that you can learn from and possibly even extend: +* https://github.com/spring-guides/tut-spring-boot-kotlin[tut-spring-boot-kotlin]: Sources of {spring-site}/guides/tutorials/spring-boot-kotlin/[the official Spring + Kotlin tutorial] * https://github.com/sdeleuze/spring-boot-kotlin-demo[spring-boot-kotlin-demo]: Regular Spring Boot and Spring Data JPA project -* https://github.com/mixitconf/mixit[mixit]: Spring Boot 2, WebFlux, and Reactive Spring Data MongoDB +* https://github.com/mixitconf/mixit[mixit]: Spring Boot, WebFlux, and Reactive Spring Data MongoDB * https://github.com/sdeleuze/spring-kotlin-functional[spring-kotlin-functional]: Standalone WebFlux and functional bean definition DSL * https://github.com/sdeleuze/spring-kotlin-fullstack[spring-kotlin-fullstack]: WebFlux Kotlin fullstack example with Kotlin2js for frontend instead of JavaScript or TypeScript * https://github.com/spring-petclinic/spring-petclinic-kotlin[spring-petclinic-kotlin]: Kotlin version of the Spring PetClinic Sample Application -* https://github.com/sdeleuze/spring-kotlin-deepdive[spring-kotlin-deepdive]: A step-by-step migration guide for Boot 1.0 and Java to Boot 2.0 and Kotlin -* https://github.com/spring-cloud/spring-cloud-gcp/tree/master/spring-cloud-gcp-kotlin-samples/spring-cloud-gcp-kotlin-app-sample[spring-cloud-gcp-kotlin-app-sample]: Spring Boot with Google Cloud Platform Integrations - - - -[[issues]] -== Issues - -The following list categorizes the pending issues related to Spring and Kotlin support: - -* Spring Framework -** {spring-framework-issues}/20606[Unable to use WebTestClient with mock server in Kotlin] -** {spring-framework-issues}/20496[Support null-safety at generics, varargs and array elements level] -* Kotlin -** {kotlin-issues}/KT-6380[Parent issue for Spring Framework support] -** {kotlin-issues}/KT-5464[Kotlin requires type inference where Java doesn't] -** {kotlin-issues}/KT-20283[Smart cast regression with open classes] -** {kotlin-issues}/KT-14984[Impossible to pass not all SAM argument as function] -** {kotlin-issues}/KT-15125[Support JSR 223 bindings directly via script variables] -** {kotlin-issues}/KT-6653[Kotlin properties do not override Java-style getters and setters] diff --git a/framework-docs/modules/ROOT/pages/languages/kotlin/web.adoc b/framework-docs/modules/ROOT/pages/languages/kotlin/web.adoc index 459b49103a5f..e594069b0d4a 100644 --- a/framework-docs/modules/ROOT/pages/languages/kotlin/web.adoc +++ b/framework-docs/modules/ROOT/pages/languages/kotlin/web.adoc @@ -8,9 +8,9 @@ Spring Framework comes with a Kotlin router DSL available in 3 flavors: -* WebMvc.fn DSL with {spring-framework-api-kdoc}/spring-webmvc/org.springframework.web.servlet.function/router.html[router { }] -* WebFlux.fn <> DSL with {spring-framework-api-kdoc}/spring-webflux/org.springframework.web.reactive.function.server/router.html[router { }] -* WebFlux.fn <> DSL with {spring-framework-api-kdoc}/spring-webflux/org.springframework.web.reactive.function.server/co-router.html[coRouter { }] +* xref:web/webmvc-functional.adoc[WebMvc.fn DSL] with {spring-framework-api-kdoc}/spring-webmvc/org.springframework.web.servlet.function/router.html[router { }] +* xref:web/webflux-functional.adoc[WebFlux.fn Reactive DSL] with {spring-framework-api-kdoc}/spring-webflux/org.springframework.web.reactive.function.server/router.html[router { }] +* xref:languages/kotlin/coroutines.adoc[WebFlux.fn Coroutines DSL] with {spring-framework-api-kdoc}/spring-webflux/org.springframework.web.reactive.function.server/co-router.html[coRouter { }] These DSL let you write clean and idiomatic Kotlin code to build a `RouterFunction` instance as the following example shows: @@ -126,7 +126,7 @@ project for more details. [[kotlin-multiplatform-serialization]] == Kotlin multiplatform serialization -As of Spring Framework 5.3, {kotlin-github-org}/kotlinx.serialization[Kotlin multiplatform serialization] is +{kotlin-github-org}/kotlinx.serialization[Kotlin multiplatform serialization] is supported in Spring MVC, Spring WebFlux and Spring Messaging (RSocket). The builtin support currently targets CBOR, JSON, and ProtoBuf formats. To enable it, follow {kotlin-github-org}/kotlinx.serialization#setup[those instructions] to add the related dependency and plugin.