https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
a

antonarhipov

07/07/2022, 12:39 PM
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

kenkyee

07/07/2022, 12:40 PM
typo in comment:
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

antonarhipov

07/07/2022, 12:56 PM
@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

kenkyee

07/07/2022, 1:00 PM
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

antonarhipov

07/07/2022, 1:03 PM
Makes sense to add the notes about these details, for sure. Thank you!
👍 1
p

PoisonedYouth

07/07/2022, 6:44 PM
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

antonarhipov

07/07/2022, 8:37 PM
Yes. I'm considering testing part as well
p

PoisonedYouth

07/08/2022, 5:17 AM
Perfect. The introduction to Kotlin+ spring is a good starting point 👍
a

Anastasia Rozovskaya

07/08/2022, 2:03 PM
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

antonarhipov

07/09/2022, 6:05 AM
@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

PoisonedYouth

07/09/2022, 6:17 AM
I've written an blog article regarding testing Kotlin+ SpringBoot + TestContainers in an easy way. If you need input, I can share it.
a

antonarhipov

07/09/2022, 6:22 AM
Sure, it will be useful. I have the content for thestcontainers on our YouTube channel but maybe I could add something
p

PoisonedYouth

07/09/2022, 6:40 AM
Feel free to use it: https://link.medium.com/1wZVjLg2vrb
:thank-you: 1