Hello! Good docs is an asset, so we are constantly...
# server
a
Hello! Good docs is an asset, so we are constantly trying to improve 🙂 I’m working on improving the Spring/Kotlin tutorial in the docs and would love to hear some feedback.
👏 5
k
typo in comment:
Copy code
Th version of Kotlin to use
👍 2
also maybe should mention that you can't just update to the latest version of Kotlin....Spring has to work with it (I remember waiting for a while for Kotlin 1.6 support)
not sure about putting jdbctemplate access in the Service layer...I thought it belonged in the Repository layer?
also not sure it's worth mentioning, but if you use the Hibernate ORM DB layer, you should not use data classes because it breaks Hibernate
Rest of tutorial looks good for a simple intro to Kotlin/Spring 👍
a
@kenkyee thanks! I asked the Spring Team about the versions and the official view on it is this:
Spring Boot 2.x requires Kotlin 1.3+
Spring Boot 3.x requires Kotlin 1.7+
not sure about putting jdbctemplate access in the Service layer...I thought it belonged in the Repository layer?
Did you mean Spring Data repository (covered later in the tutorial)? Using jdbctemplate from a service is what Josh Long does every time - I can’t fight that 😅
also not sure it’s worth mentioning, but if you use the Hibernate ORM DB layer, you should not use data classes because it breaks Hibernate
Oh yes, we have a full webinar about that. I think this will be linked from this tutorial as a follow-up to learn after the basics
k
Did you mean Spring Data repository (covered later in the tutorial)? Using jdbctemplate from a service is what Josh Long does every time - I can’t fight that 😅
lol...I've been ignoring that part of Josh's suggestions 🙂
I asked the Spring Team about the versions and the official view on it is this:
> Spring Boot 2.x requires Kotlin 1.3+
> Spring Boot 3.x requires Kotlin 1.7+
Yep...it's just something folks might not be aware of....that Spring's Kotlin support for the latest minor point release does lag quite a bit.
a
Makes sense to add the notes about these details, for sure. Thank you!
👍 1
p
Will there be a separate introduction to spring + Kotlin and testing (as mentioned in "What's next" section) ? Especially when using Mockito there are some things to care of, comparing to Java.
1
a
Yes. I'm considering testing part as well
p
Perfect. The introduction to Kotlin+ spring is a good starting point 👍
a
Hi, Anton! I made a list of suggestions, mainly typos and renaming. The core of this tutorial is great and easy to follow. 1. [p.4:] Packages and classes under the main/kotlin folder that belong to the application. (It seems that you are missing the verb
to be
here) -> “Packages and classes that belong to the application are under the main/kotlin folder” || “There are packages and classes under the main/kotlin folder that belong to the application.” || “Packages and classes that belong to the application can be found under the main/kotlin folder” 2. [p.6: Nit.] kotlin(“jvm”) -The plugin defines the version of Kotlin to be used in the project (
The
could be changed to
This
, if you feel that way). Also check other similar places. 3. [p.6: Nit.] You use `dependencies block` and
_dependencies_ section
on the same page referring to the same thing. It might be better to stick with single naming. 4. [p.7: Nit.] The annotation enables Spring Boot’s auto-configuration, component scan and be able to define extra configuration on their “application class”. -> … and the ability to define extra configuration ... 5. [p.8: Nit.] Hence, if we access the application at the root (“/”) and supply a request parameter called “name” the parameter value will be used as an argument for invoking the index function. (add one
,
) -> … called “name”*,* the parameter value … 6. [p.11] This is a factory function to create an read-only list of objects. (change
an
to
a
) -> … to create a read-only list … 7. [p.10] This is probably too specific, but you can point out that when we change MessageResource controller to return a list of Message objects, we do not provide any parameters for
index()
function anymore. 8. There are multiple times, when a sentence starts with
Hence
, but I can’t figure out why sometimes you put
,
after this word, and sometimes you don’t. 9. [p.13]
fun save(message: Message){
<- formatting (space between
)
and
{
is missing) 10. [p. 15] [Elvis operator (If-not-null-else shorthand )](null-safety.md#elvis-operator) looks like a wrongly formatted link 11. [p. 18] Create the requests.http file -> add explanation where in a project hierarchy one should create this file like “Create the requests.http file under your project directory, see an image below the following code” 12. [p. 19] curl -X POST --location “http://localhost:8080” -H “Content-Type: application/json” -d “{ \“text\“: \“Hello!\” }” Here is a typo, you should also escape
!
or the request would not work, so the correct command wouls be -> curl -X POST --location “http://localhost:8080” -H “Content-Type: application/json” -d “{ \“text\“: \“Hello\!\” }” 13. [p. 20]
fun findMessageById(id: String): List<Message>
return list of messages, so naming could be more accurate like
getMessagesById
14. [p. 22] For that, we need to unwrap the
Optional
value is it’s present, and return a list with the value. <- this sentence is difficult to parse at “unwrap the
Optional
value is it’s present”. 15. [p. 22] Fix link “This can be implemented as an [extension function](extensions.md#extension-functions) to the`Optional` type.” 16. [p. 23] The same 17. [p. 23] CrudRepository’ save() function (I presume there is a missing
s
) -> CrudRepository’*s* 18. [p. 23] This is what the
id
property should be declared using the
var
keyword. (what -> why) -> This is why the
id
property should be declared using the
var
keyword. 19. [p. 23] we can use the
RANDON_UUID()
(typo in random) -> we can use the
RANDOM_UUID()
👍 2
a
@Anastasia Rozovskaya thanks much! The links are in our internal markdown format for the documentation tool - I didn't clean those up when generating the pdf. These will be ok once rendered property with the documentation engine 👍
🙂 1
p
I've written an blog article regarding testing Kotlin+ SpringBoot + TestContainers in an easy way. If you need input, I can share it.
a
Sure, it will be useful. I have the content for thestcontainers on our YouTube channel but maybe I could add something
p
🙏 1