https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
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
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
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
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 Linen
spring
  • a

    Adam Crane

    03/16/2021, 1:36 PM
    Hi all, I can't seem to wrap my head around getting Springdoc to work with my Kotlin Spring Boot app that uses the function DSL to register beans and routes. (There are no Bean, Service, etc annotations) Does anyone have an example on how to get this to work? I have tried putting the RouterOperation annotation on the handler methods, but the swagger ui still comes up empty.
    t
    • 2
    • 18
  • d

    Dplex

    03/19/2021, 4:55 AM
    Hi guys. I'm using JPA(Hibernate), but doesn't work auto-complete in the repository class. It works fine in java, but not kotlin. i don't know why doesn't work in kotlin-jpa The Intellij version you are using is 2020.1.2.
    👀 1
    i
    m
    • 3
    • 2
  • n

    nfrankel

    03/21/2021, 4:41 PM
    kotlin + spring + graalvm = ❤️ https://blog.frankel.ch/kick-spring-native-tires/
    👍 5
    k
    • 2
    • 2
  • c

    chavanshashank

    03/22/2021, 12:32 PM
    I have a scenario in which multiple users of the application will be simultaneously uploading excel sheet(small to huge) to the spring boot backend. After uploading that excel sheet, I have to process it for validations using POI for that which is fine and then store the whole excel sheet data in a database. What libraries or architecture should I choose? Is Spring data flow is the correct choice?! Or Uploading those files to Amazon S3 bucket and after uploading Queuing them in Amazon SQS and processing them in Spring MVC is sufficient for concurrent file uploads, processing and storing them in a DB without table inconsistency.
    :kotlin-flag: 1
    :not-kotlin: 2
    p
    a
    t
    • 4
    • 8
  • i

    iamkdblue

    03/25/2021, 9:54 AM
    message has been deleted
    s
    • 2
    • 2
  • i

    iamkdblue

    03/31/2021, 1:02 PM
    I am getting this error while accessing Repository from other module, even i tried stackoverflow answer but it didnt workout, does anyone experience with error?
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hanaServiceImpl': Unsatisfied dependency expressed through field 'userMappingRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMappingRepository' defined in net.broachcutter.repository.UserMappingRepository defined in @EnableJpaRepositories declared on DealerMainApplication: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: kotlin/reflect/full/KClasses
    n
    • 2
    • 2
  • n

    nicholasnet

    04/06/2021, 12:03 AM
    Can we use launch like this in Spring Webflux Controller
    suspend fun test() : Response = coroutineScope {
        launch {
            doSomething()
        }
    
        Response(“pass”)
    }
    Will doSomething will keep on running in background once Response is returned. I have used async but not launch
    d
    • 2
    • 6
  • s

    Slackbot

    04/07/2021, 11:26 AM
    This message was deleted.
    r
    j
    t
    • 4
    • 5
  • g

    geepawhill

    04/07/2021, 5:00 PM
    The fix for this appears to be marking the controller method as
    open fun
    instead of fun. As it is a leaf class, I don't understand why this would be so. Any ideas?
    d
    n
    m
    • 4
    • 19
  • r

    rajesh

    04/07/2021, 10:58 PM
    How do i override spring dependency in gradle (kotlin) file? I'm using spring boot version
    2.4.4
    which has
    2.4.4
    vesrion of
    spring-boot-starter-data-redis
    I want to use
    2.4.7
    version of it and tried following lines but it's not working
    implementation("org.springframework.boot:spring-boot-starter-data-redis:2.4.7")
    it says
    Could not find org.springframework.boot:spring-boot-starter-data-redis:2.4.7.
    Required by:
    project :
    I've also tried adding following line to build.gradle file with no luck
    extra["spring-data-redis.version"] = "2.4.7"
    s
    m
    • 3
    • 19
  • j

    Jose Antonio Jimenez

    04/08/2021, 2:13 PM
    I have been using suspend functions controller with Spring Boot, but seems that currently Spring Security does not support it with @PreAuthorize annotations. Anyone knows is this is going to be fixed anytime soon?
    s
    s
    • 3
    • 4
  • r

    rajesh

    04/11/2021, 2:53 PM
    This is rather architectural question. I'm using postgresql as primary database and elastic search as search engine in spring boot. I'm only storing portion of data columns of postgres into elastic search. When user search for any data, I search in elastic search, get their id and retrieve data from postgres to send response. Am I doing anything wrong? Should I store all data in elastic search? If so, there will be overhead of updating data everytime when there's update in postgres.
    p
    j
    a
    • 4
    • 3
  • s

    ShootingStar

    04/14/2021, 5:07 PM
    Hi Guys, In Kotlin, is there a good reason I have to use immutable class for JPA entities? My colleague said he prefer to design like that and it is a good way to reduce some side-effects. However, I don’t believe it is a good way. I think JPA entities are born with a characteristic that its properties will be update one day. I read the persistence-with-jpa section in the spring boot kotlin tutorail and I show it to my colleague but he said he could not agree with it. What’s your opinion?
    s
    n
    c
    • 4
    • 14
  • l

    Luca Piccinelli

    04/15/2021, 7:27 AM
    Good morning. Does anyone know which version of spring introduced the beans and routing kotlin DSLs ? https://docs.spring.io/spring-framework/docs/current/reference/html/languages.html#kotlin-web
    n
    s
    t
    • 4
    • 21
  • l

    Luca Piccinelli

    04/16/2021, 6:55 AM
    By the way... what could be a good starting point for contributing to the bean/routing definition DSL?
    s
    • 2
    • 4
  • t

    Tapiwanashe Shoshore

    04/16/2021, 12:33 PM
    Hi guys I'm  looking for a Remote job! I'm a backend Developer specialized in JAVA/SPRING-BOOT I live in Harare, Zimbabwe but would like to work remote. If you know of any opportunities, please link me Contact me on tapsshore@gmail.com  || +263771222822 skype: tapsshore
    n
    • 2
    • 1
  • g

    Gopal S Akshintala

    04/17/2021, 8:28 AM
    Can someone please help me with any blog post/paper/TT for the case against Annotations and why Spring-fu advocates file based config over Annotations?
    n
    l
    +2
    • 5
    • 24
  • t

    Thomas

    04/19/2021, 8:49 AM
    Hi there, Bootify.io has now a Kotlin option to create a Spring Boot app with custom database, REST API and more. Hope it's useful! I haven't worked with Kotlin a lot in the past, so if you have a recommendation on what to improve, please let me know. :-)
    👍 1
    r
    • 2
    • 2
  • n

    Nowak

    04/19/2021, 2:16 PM
    Hi 🙂 I’m looking for some resources to learn Spring WebFlux with Kotlin Coroutines (I have experience with Spring WebFlux with Java and Reactor). Could you recommend something?
    r
    s
    • 3
    • 2
  • m

    MrNiamh

    04/20/2021, 8:16 AM
    Hi, i’m using Spring Webflux and trying to add some logging around each response by using a ServerHttpResponseDecorator. The responses are coming back fine via postman, however I’ve noticed I can no longer load my swagger UI (just get a blank white screen). Anyone know why? Code in thread
    :stackoverflow: 1
    m
    • 2
    • 3
  • i

    iamkdblue

    04/25/2021, 2:55 PM
    Hi all cool dev ! i am new in spring boot, recently i come to sentry for crashlytics! i read the doc but is there any way to send crashlytics at once without writing in every catch block !
    :not-kotlin: 1
    r
    n
    • 3
    • 4
  • r

    rajesh

    04/26/2021, 10:51 AM
    I'm using PostgreSQL and Spring data JPA to execute update as following
    @Transactional
    @Modifying(flushAutomatically = true, clearAutomatically = true)
    @Query(
         "UPDATE posts SET comments_count = comments_count +1 WHERE post_id = :postId RETURNING comments_count",
          nativeQuery = true
    )
    fun incrementCommentCounter(@Param("postId") postId: Long): Int
    As i'm using native query with 
    RETURNING
     clause, it throws exception as
    o.h.engine.jdbc.spi.SqlExceptionHelper   : A result was returned when none was expected.
    How should i execute this query with spring boot?
    :not-kotlin: 1
    i
    k
    • 3
    • 3
  • l

    Luca Piccinelli

    04/27/2021, 6:54 AM
    Hi guys, I'm experimenting with the production ready parts of Kotlin DSL for Springboot. I'm obtaining great results, from a design perspective. Doing TDD is much more simples! But now I'm trying to introduce spring security, also with DSL (following this https://www.baeldung.com/kotlin/spring-security-dsl and this https://spring.io/blog/2020/03/04/spring-tips-kotlin-and-spring-security). When I introduce the
    spring-boot-starter-security
    then all the tests of the endpoints fail with 401. Do any of you knows which is the suggested approach to test DSL-defined endpoints when security is in place? Disabling security with annotations doesn't work, as also the tests doesn't use the usual @SpringBootTest annotation, but instead starts the application programmatically. I was searching for a command line argument that disables security, but without any luck :(
    n
    k
    • 3
    • 14
  • i

    iamkdblue

    04/27/2021, 1:47 PM
    Hi @nfrankel and all devs can you tell me any good crashlytics for spring boot kotlin, i know sentry other than that will highly appreciated!
    m
    n
    • 3
    • 3
  • f

    Fleshgrinder

    04/27/2021, 8:39 PM
    Anyone knows if it's possible to get auto-completion in Mustache templates to work in IntelliJ? I'm using the Spring Boot Starter Mustache with a very basic MVC setup, but it's basically guessing what's available by checking back and forth with the code. 😞
    :not-kotlin: 3
    m
    • 2
    • 1
  • m

    mickeelm

    04/28/2021, 9:18 AM
    In the light of what this channel's discussions mostly been about the last few days (what should be discussed here and what shouyld not), what do you think of changing to a topic that makes it a bit more clear? Suggestion: "Discussions on Kotlin specific integration with Spring, not Spring in general. For Spring-generic questions, try Gitter: https://gitter.im/spring-projects/. Spring Boot Kotlin guides: https://spring.io/guides/tutorials/spring-boot-kotlin/"
    👍 6
    💯 1
    n
    t
    +4
    • 7
    • 19
  • s

    Sangeet Narayan

    05/01/2021, 1:26 PM
    Hello everyone! Can anybody suggest some good cloud hosting option for a Kotlin Spring project. I have currently hosted it on Heroku but the downside is that it sleeps after 30 mins of inactivity and takes time to start again(or sleeps permanently if my dyno hours are exhausted). Looking for option that is cheap(maybe has a free plan :p) and is up for most of the time
    k
    • 2
    • 2
  • b

    Brian Dilley

    05/02/2021, 4:36 AM
    I’m using the kotlin-dsl and the buildSrc plugin and somehow my spring boot webapp ends up with
    gradle-api-7.0.jar
    in it’s classpath (and bundled in the bootJar)
    • 1
    • 1
  • k

    kenkyee

    05/02/2021, 11:58 AM
    What do folks use for a Kotlin type-safe SQL framework w/ Spring Boot and schema migration? I tried using JOOQ but hit issues w/ it not being compatible with Liquibase's YAML files and the Postgres JSONB data type. Thought about using SqlDelight but it doesn't have Liquibase's nice DB schema management for rollbacks. Exposed has an open issue on schema migration and sounds like it's still not quite ready for prime time. I'm using plain old JDBCTemplate which feels a bit retro because it's just a thin layer over prepared statements...though it is nice that it has @Transactional support in Spring 🙂
    t
    k
    +2
    • 5
    • 7
  • h

    Hamza GATTAL

    05/03/2021, 5:02 PM
    Hi Everyone! I have one easy question How i can write @NotNull, @NotEmpty and @NotBlank in kotlin
    e
    b
    +2
    • 5
    • 6
Powered by Linen
Title
h

Hamza GATTAL

05/03/2021, 5:02 PM
Hi Everyone! I have one easy question How i can write @NotNull, @NotEmpty and @NotBlank in kotlin
e

Emil Kantis

05/03/2021, 5:05 PM
@get:NotNull
etc. Although I'm not sure why you would need
@NotNull
🙂
another option is using
init { require(someStringProperty.isNotEmptyOrBlank()) }
, but that doesn't follow Spring conventions I suppose
h

Hamza GATTAL

05/03/2021, 5:07 PM
I'm converting a Java code to kotlin
💡 2
b

Ben

05/03/2021, 7:12 PM
@Emil Kantis Jackson will set non-nullable fields to null using reflection.
💣 1
t

thanksforallthefish

05/04/2021, 5:35 AM
personally I’d rather have the json representation accepts nulls and being annotated with
@NotNull
than having the field not-nullable, it makes for easier and better error message given the stack I use (spring boot, web and validation).
@NotNull
generates a validation exception which I can treat as all other validations exceptions, which not-nullable field is a kotlin binding error, which needs special treatment. eg
class SomeApiRepresentation(@get:NotNull aNotNullableField: String?)
the price of course is
!!
, but I am not a purist, and in this case
!!
is fine with me
t

Thomas

05/04/2021, 8:05 AM
I also would vote for @thanksforallthefish’s approach, as a field with null value is a possible input and only validation may fail. You can have a look at bootify.io, it generates a REST controller for a Kotlin/Spring project
View count: 9