:loudspeaker: hello folks! We are in process of up...
# spring
a
๐Ÿ“ข hello folks! We are in process of updating the Spring-Kotlin tutorial in our documentation. I think itโ€™s a good time to ask for the feedback from the community. We donโ€™t plan to make it super-comprehensive though, the goal is rather to show how to get started with Kotlin in the Spring projects and cover some of the obvious use cases. Here I have the first draft. Please let me know what do you think about in the thread ๐Ÿงต
๐Ÿ‘ 3
m
Is there a link somewhere to the final Github repo? Or even better, a Github template?
a
So far, only this, only with the final code state. There are the intermediate commits as well though: https://github.com/antonarhipov/kotlin-spring-demo
๐Ÿ‘Œ 1
m
Nice! I'd put the link as a preamble
a
I will probably split the repository into branches for each stage of the tutorial in the final version
m
That'd be nice althoug TBH a lot of work ๐Ÿ˜…
a
itโ€™s for the good cause ๐Ÿ˜‰
๐Ÿ’™ 1
m
Yup ๐Ÿ™‚
e
I mean, Spring Initializr puts some outdated stuff into the gradle files.. I would raise an issue or contribute a fix to that.. Or at least mention what it does wrong in the guide
โž• 1
a
@Emil Kantis can you give an example? I canโ€™t recall anything like that atm
e
Also it would feel more "kotlin" to me to use Webflux and DSL routing rather than annotation-driven code.. But I guess it depends on the audience ๐Ÿ™‚
Copy code
mplementation("org.jetbrains.kotlin:kotlin-reflect")  Kotlin reflection
library, required for working with Spring
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
Adding stdlib is no longer needed, gradle plugin adds it automatically and I would change the kotlin reflect dependency to
implementation(kotlin("reflect"))
๐Ÿ™ 1
a
Yeah. Webflux is not something we want to throw at the users right from the beginning, I think. We do plan to develop this tutorial further, so yeah, I think we will bring in the dsl a bit later
๐Ÿ‘ 3
s
if your goal is to get more people using kotlin and spring, i recommend looking at it from the lens of "how to get java and kotlin to coexist in a spring environment". (kapt) But also, higher priority at least for me, is how to get hibernate/JPA to play nicely with kotlin. And I mean real-world entities, not "everything is so simplistic wee, we stored 2 strings and it's so nice" that I frequently see I've had to scour a crazy number of resources to get the information I needed just to convert my hibernate JPAs over to kt. Many would say totally different things. Then I ran into an Intellij bug which is unfixed, for embeddable entities that gives a false positive for an inspection And right now, I'm running into a failure of smart casting because of the all-open plugin, which i'm wondering if there's a workaround for
๐Ÿ‘ 1
c
I would suggest adding
@Column
to show custom names, many organizations have specific naming conventions or may be using existing existing tables. Also create separate interface for MessageService so that Controller depends on interface and not implementation
๐Ÿ‘€ 1
s
Nice, maybe renaming
MessageResource
to
MessageController
would be more idiomatic?
๐Ÿ‘ 1
I like the fact you use Spring Data JDBC
s
i agree with the
@Column
, be more in line with what most people are doing (including my orgs code)
s
You could use Kotlinx Serialization and exclude Jackson dependencies.
โž• 1
๐Ÿ‘ 3