From 1ef8800c6c6b5c1d7f4a90ddc7853786127840e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 13 Jul 2022 09:13:26 +0200 Subject: [PATCH 1/4] Fix Kotlin example for custom @Production Closes gh-28680 --- src/docs/asciidoc/core/core-beans.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc index 612804beae9..ab78bab146f 100644 --- a/src/docs/asciidoc/core/core-beans.adoc +++ b/src/docs/asciidoc/core/core-beans.adoc @@ -9654,7 +9654,7 @@ of creating a custom composed annotation. The following example defines a custom [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] .Kotlin ---- - @Target(AnnotationTarget.TYPE) + @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) @Profile("production") annotation class Production From d1df4d37395be786bea0141a9d90775ebe63102b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 13 Jul 2022 09:19:08 +0200 Subject: [PATCH 2/4] Fix Kotlin code snippets language Closes gh-28810 --- src/docs/asciidoc/core/core-beans.adoc | 2 +- src/docs/asciidoc/testing.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc index ab78bab146f..577aa3a16e0 100644 --- a/src/docs/asciidoc/core/core-beans.adoc +++ b/src/docs/asciidoc/core/core-beans.adoc @@ -1368,7 +1368,7 @@ The following example shows the corresponding `ExampleBean` class: } } ---- -[source,java,indent=0,subs="verbatim,quotes",role="secondary"] +[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] .Kotlin ---- class ExampleBean( diff --git a/src/docs/asciidoc/testing.adoc b/src/docs/asciidoc/testing.adoc index 6af933f2bc8..3a54a476bd2 100644 --- a/src/docs/asciidoc/testing.adoc +++ b/src/docs/asciidoc/testing.adoc @@ -2523,7 +2523,7 @@ listeners. The following listing demonstrates this style of configuration: } ---- -[source,java,indent=0,subs="verbatim,quotes",role="secondary"] +[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] .Kotlin ---- @ContextConfiguration From 1201af20e4f15144a9289c443c80642011fddb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 13 Jul 2022 09:42:47 +0200 Subject: [PATCH 3/4] Improve consistency of Kotlin injection code samples Closes gh-28596 --- src/docs/asciidoc/core/core-beans.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc index 577aa3a16e0..7f9b44a4da7 100644 --- a/src/docs/asciidoc/core/core-beans.adoc +++ b/src/docs/asciidoc/core/core-beans.adoc @@ -4786,7 +4786,7 @@ as the following example shows: ---- class SimpleMovieLister { - @Autowired + @set:Autowired lateinit var movieFinder: MovieFinder // ... @@ -5937,7 +5937,7 @@ named `movieFinder` injected into its setter method: ---- class SimpleMovieLister { - @Resource + @set:Resource private lateinit var movieFinder: MovieFinder } @@ -7303,11 +7303,11 @@ preceding example: class SimpleMovieLister { @Inject - lateinit var movieFinder: MovieFinder + lateinit var movieFinder: Provider fun listMovies() { - movieFinder.findMovies(...) + movieFinder.get().findMovies(...) // ... } } From c942c8d2cf510b1fac6c4e79224ddf7cdcf358e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Wed, 13 Jul 2022 10:06:41 +0200 Subject: [PATCH 4/4] Fix expectations in MockMvc Kotlin documentation Closes gh-28301 --- src/docs/asciidoc/testing.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/docs/asciidoc/testing.adoc b/src/docs/asciidoc/testing.adoc index 3a54a476bd2..9262496418a 100644 --- a/src/docs/asciidoc/testing.adoc +++ b/src/docs/asciidoc/testing.adoc @@ -7367,7 +7367,7 @@ no other expectations will be asserted. import org.springframework.test.web.servlet.get mockMvc.get("/accounts/1").andExpect { - status().isOk() + status { isOk() } } ---- @@ -7415,7 +7415,7 @@ The following test asserts that binding or validation failed: import org.springframework.test.web.servlet.post mockMvc.post("/persons").andExpect { - status().isOk() + status { isOk() } model { attributeHasErrors("person") } @@ -7443,7 +7443,7 @@ request. You can do so as follows, where `print()` is a static import from mockMvc.post("/persons").andDo { print() }.andExpect { - status().isOk() + status { isOk() } model { attributeHasErrors("person") } @@ -7473,7 +7473,7 @@ other expectations, as the following example shows: [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] .Kotlin ---- - var mvcResult = mockMvc.post("/persons").andExpect { status().isOk() }.andReturn() + var mvcResult = mockMvc.post("/persons").andExpect { status { isOk() } }.andReturn() // ... ---- @@ -7593,7 +7593,7 @@ or reactive type such as Reactor `Mono`: @Test fun test() { var mvcResult = mockMvc.get("/path").andExpect { - status().isOk() // <1> + status { isOk() } // <1> request { asyncStarted() } // <2> // TODO Remove unused generic parameter request { asyncResult("body") } // <3> @@ -7602,7 +7602,7 @@ or reactive type such as Reactor `Mono`: mockMvc.perform(asyncDispatch(mvcResult)) // <4> .andExpect { - status().isOk() // <5> + status { isOk() } // <5> content().string("body") } }