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
  • p

    poohbar

    04/19/2018, 1:14 PM
    I just expected it to also work with
    Boolean
    but that would be too much magic
    c
    t
    • 3
    • 3
  • p

    Pere Casafont

    04/19/2018, 11:13 PM
    hi there, I'm having a very strange issue with my spring boot 2 test project: when I perform a GET request it works fine, but on POST it always throws a 401 with plain text
    CSRF Token has been associated to this client
    ... any ideas?
    :stackoverflow: 1
    l
    p
    • 3
    • 5
  • m

    Michael

    04/20/2018, 7:04 PM
    I have a batch job I’m working on. I have my processor returning a
    Pair
    , and a
    CompositeItemWriter
    that sends half the pair to each of two individual writers. But if something goes wrong, I only want to write to one: normally you can return null from a processor and nothing gets written, but if I return
    Pair(object1, null)
    , then the writer that receives the null gives me a
    Target object must not be null
    . Am I approaching this the wrong way, or is there a way around this?
    p
    t
    • 3
    • 10
  • p

    Pere Casafont

    04/22/2018, 11:10 PM
    my apologies for not having seen it
    s
    • 2
    • 1
  • d

    diesieben07

    04/23/2018, 11:37 AM
    Before I spend a bunch of time on a pullrequest... Is it a terrible idea to declare a generated ID as a
    lateinit var
    in a JPA entity? Right now it fails, because Spring Data's
    isNew
    check accesses the ID and expects null, this could be patched to allow for
    lateinit
    . Is that a good idea?
    c
    f
    p
    • 4
    • 20
  • l

    Lucas

    04/24/2018, 8:02 PM
    Is it possible to implement a server that responds both HTTP calls and WebSockets using
    router { }
    block? I've been developing an API without Spring annotations but couldn't understand how to wire them. Here is my last attempt: https://github.com/lucasvalenteds/responder/commit/1e4714304b0a24d59a55e36770b476c954b2dee1
    s
    • 2
    • 5
  • v

    visakha

    04/25/2018, 12:02 AM
    How to make the Main thread wait until the Flux has completed all its feed
    @Test
        fun testFnCall_partyAddrByCleanCd() {
            println("\n\n\n\n ---------------- SEE MEE START  ----------------------")
            val start = System.currentTimeMillis()
            val res = ecmDbSvc.callFnGetPartyAddrByExtCleanCd("ECM-123")
            assert(res != null)
            assertTrue(res.count() == 100)
            val fluxOfPartyAddr = Flux.fromIterable(res)
                    .delayElements(Duration.ofMillis(100))
                    .parallel(4).runOn(Schedulers.parallel())
                    .doOnNext { e -> println(e.addrLine1) }
    
            // fluxOfPartyAddr.blockLast()  --> Invalid when using parallel
            fluxOfPartyAddr.doOnComplete {
                val end = System.currentTimeMillis()
                println("time talen: " + (end - start) + " milliSeconds")
                println("---------------- SEE MEE START COMPLETE ----------------------")
    
            }
    
            fluxOfPartyAddr.subscribe()
            //        ??? anything here to make the thread wait ???
    
        }
    l
    s
    • 3
    • 4
  • s

    sdeleuze

    04/25/2018, 1:10 PM
    The right link for the kapt issue is in fact https://youtrack.jetbrains.com/issue/KT-15040#comment=27-2840615
    😡 1
    p
    • 2
    • 23
  • c

    Czar

    04/25/2018, 7:31 PM
    Considering mbogdanov's comment on the issue, should Spring be updated to support kotlin 1.2.40? https://youtrack.jetbrains.com/issue/KT-23973
    ➕ 1
    s
    • 2
    • 2
  • a

    andyb

    04/27/2018, 8:16 AM
    Thanks, tried that & ended up with different errors, think I have created a sort of hybrid Unit Test. Will probably just go with the manual creation of the MockMvc for the time being as it allows me to test the controller interface whilst mocking out the backing services.
    s
    m
    • 3
    • 3
  • a

    andyb

    04/27/2018, 1:48 PM
    @Michael Thank's, I'll give it another shot on my commute home tonight
    m
    s
    • 3
    • 5
  • a

    avolkmann

    04/28/2018, 6:44 PM
    Hey guys, just trying out spring in kotlin and I followed the guides / start.spring.io but I always get told that Application is final, even though I have the allopen plugin.
    c
    • 2
    • 1
  • a

    avolkmann

    04/28/2018, 7:00 PM
    I also tried by myself with the tutorial from jetbrains: https://kotlinlang.org/docs/tutorials/spring-boot-restful.html
    c
    n
    • 3
    • 20
  • m

    mcblum

    04/29/2018, 2:11 PM
    Has anyone ever run in to
    No Beans of TestRestTemplate found
    ? According to the testing guide, if you provide a local port then it should automatically wire it up for you. https://spring.io/guides/gs/testing-web/ For whatever reason that’s not happening.
    a
    • 2
    • 1
  • s

    sdeleuze

    05/04/2018, 2:32 PM
    Hey, here is a first draft version of the Spring Boot 2 + Kotlin tuto I will publish on spring.io. I still need to fix typos, polish the code, write the chapter on
    @ConfigurationProperties
    , etc. but I would appreciate some early feedback, and eventually some improvements via PR (typos, sentences improvements since I am not native english speaker, etc.). I will start working on the WebFlux + functional API + reactive MongoDB + WebTestClient one next week. Thanks and have a good weekend. https://github.com/sdeleuze/tut-spring-boot-kotlin
    👍 2
    p
    f
    k
    • 4
    • 5
  • s

    sdeleuze

    05/04/2018, 2:34 PM
    Please do not share it yet, the repo address will change.
    c
    • 2
    • 2
  • a

    avolkmann

    05/05/2018, 8:41 AM
    Are there any common things to watch out for when wiring Properties from a yml file in kotlin?
    • 1
    • 2
  • c

    Carlos Ottoboni

    05/09/2018, 11:50 AM
    Good morning everyone. I need a help from you guys. I'm developing a service using Kotlin and Spring with MySQL database, and Spring JPA, in my service I have some custom queries in my database like this one:
    @Modifying
        @Transactional
        @Query("DELETE FROM CollectionComicBook WHERE comic_book_id = ?1")
        fun deleteByComicBookId(comicBookId: Long): Int
    When I run this query it works ok, I can see in my database that the value is being deleted, however my service return this error:
    "Modifying queries can only use void or int/Integer as return type!; nested exception is java.lang.IllegalArgumentException: Modifying queries can only use void or int/Integer as return type!
    I've tried to change the return type to Long, Integer (from java), Unit and also leave it blank, but I'm still getting this error. I don't know what I can do to solve this. Anyone can help me with this?
    g
    h
    • 3
    • 5
  • s

    sdeleuze

    05/09/2018, 1:04 PM
    I am almost done with my Spring Boot 2 + Kotlin + JPA tuto, feedback and fixes (via PR) welcome https://github.com/sdeleuze/tut-spring-boot-kotlin
    👍 4
    👌 3
    h
    c
    b
    • 4
    • 8
  • s

    sdeleuze

    05/11/2018, 9:01 AM
    https://twitter.com/sdeleuze/status/994864735991533569
    👍🏻 12
    :kotlin-flag: 6
    n
    s
    • 3
    • 6
  • m

    Michael

    05/11/2018, 6:21 PM
    I’ve got some compiler warnings of
    Kotlin: Expected type does not accept nulls in Java, but the value may be null in Kotlin
    around a
    MapSqlParameterSource("key", null)
    - but the value can be null, as far as I can tell.
    n
    t
    • 3
    • 4
  • c

    Czar

    05/13/2018, 6:29 PM
    you can make it a bean dependency 🙂
    n
    • 2
    • 2
  • v

    visakha

    05/14/2018, 4:36 PM
    what is the slack channel for Spring Reactor
    s
    f
    • 3
    • 2
  • v

    visakha

    05/15/2018, 3:26 AM
    I applied the all-open plugin , but still I get the error
    Caused by: java.lang.IllegalArgumentException: Cannot subclass final class com.winsupply.ecm.job.infa.mdm.EcmBulkCleanUserId
    s
    • 2
    • 1
  • v

    visakha

    05/15/2018, 3:53 AM
    fun updateUserIdDefault(cbPartyXref: CBPartyXref): String {...}
    ==> this one need to be called from the above
    s
    • 2
    • 1
  • m

    Michael

    05/16/2018, 6:33 PM
    I’m trying to actually use an immutable pojo in my spring project, and I have
    jackson-module-kotlin
    in my pom dependencies. When I run my
    NamedParameterJdbcTemplate
    with a
    BeanPropertyRowMapper
    , though, it’s throwing
    Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: No argument provided for a required parameter: parameter #0
    . What might I be missing?
    • 1
    • 1
  • o

    OhWhy

    05/17/2018, 9:43 AM
    Hi, I just upgraded from Spring Boot 1.5.9 to 2.0.2 and Spring can no longer create instances of my private components. The following worked in 1.5.9:
    @Component
    private class ActivityRepositoryImpl(private val dbCursor: DbCursor) {
    	...
    }
    After upgrading Spring greets me with the following stacktrace:
    Caused by: java.lang.IllegalAccessException: Class kotlin.reflect.jvm.internal.FunctionCaller$Constructor can not access a member of class com.trireduce.persistence.ActivityRepositoryImpl with modifiers "public"
            at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102) ~[?:1.8.0_112]
            at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296) ~[?:1.8.0_112]
            at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288) ~[?:1.8.0_112]
            at java.lang.reflect.Constructor.newInstance(Constructor.java:413) ~[?:1.8.0_112]
            at kotlin.reflect.jvm.internal.FunctionCaller$Constructor.call(FunctionCaller.kt:66) ~[kotlin-reflect-1.2.41.jar:1.2.41-release-74 (1.2.41)]
            at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:107) ~[kotlin-reflect-1.2.41.jar:1.2.41-release-74 (1.2.41)]
            at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod(KCallableImpl.kt:149) ~[kotlin-reflect-1.2.41.jar:1.2.41-release-74 (1.2.41)]
            at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:111) ~[kotlin-reflect-1.2.41.jar:1.2.41-release-74 (1.2.41)]
            at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:765) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
            at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:170) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
            at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
            at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
            ... 22 more
    Does anybody have an idea how to solve this?
    m
    c
    • 3
    • 5
  • v

    visakha

    05/17/2018, 6:14 PM
    spring experts : I forked the project (simple spring boot kotlin) by @sdeleuze... and all I did is rearrange the @Configuration classes, the HttpApiTests are failing, can you please take a look, thank you https://github.com/visakha/tut-spring-boot-kotlin.git
    c
    • 2
    • 2
  • v

    visakha

    05/18/2018, 1:06 PM
    junit5 spring kotlin - I get the error
    java.lang.Exception: Test class should have exactly one public zero-argument constructor
    
    	at org.junit.runners.BlockJUnit4ClassRunner.validateZeroArgConstructor(BlockJUnit4ClassRunner.java:171)
    	at org.junit.runners.BlockJUnit4ClassRunner.validateConstructor(BlockJUnit4ClassRunner.java:148)
    	at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:127)
    	at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
    	at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84)
    	at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65)
    	at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
    	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    s
    • 2
    • 1
  • t

    tmg

    05/25/2018, 1:45 PM
    Will that talk be available as video?
    s
    s
    • 3
    • 3
Powered by Linen
Title
t

tmg

05/25/2018, 1:45 PM
Will that talk be available as video?
s

sdeleuze

05/25/2018, 2:20 PM
Sure, I will share the link asap available
t

tmg

05/25/2018, 2:22 PM
Thanks!
s

snowe

05/25/2018, 3:08 PM
Awesome!
View count: 12