https://kotlinlang.org logo
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
  • r

    rodolpho.couto

    09/09/2019, 6:00 PM
    I have an application with WebFlux/Coroutines and I need to get and persist all headers from current request (for further audit). Is there a way to put them in CoroutineContext via WebFlux Filter? Any ideas?
    d
    • 2
    • 4
  • s

    sdeleuze

    09/10/2019, 1:34 PM
    https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1568122460069200
    ❤️ 12
    :kotlin: 4
    r
    • 2
    • 3
  • e

    epchris

    09/12/2019, 12:55 AM
    message has been deleted
    t
    • 2
    • 1
  • e

    epchris

    09/12/2019, 2:08 AM
    Does spring boot perhaps impose a particular version of kotlin or coroutines?
    s
    • 2
    • 43
  • d

    Dennis Schröder

    09/12/2019, 3:13 PM
    I am experimenting with Spring Webflux and Kofu. It is working nicely so far, but I was wondering how I could use swagger to generate my api documentation. Is there a way?
    👍 1
    s
    l
    • 3
    • 6
  • r

    Robert Jaros

    09/12/2019, 6:08 PM
    When I run
    DELETE
    operation with
    spring-r2dbc
    and coroutines, by using such code inside a suspending function:
    databaseClient.execute("DELETE FROM tab WHERE field = :field").bind("field", 5).then().awaitFirstOrNull()
    Spring Boot gives me the following exception in logs:
    2019-09-12 19:52:05,849 [reactor-tcp-epoll-3] ERROR i.r.p.client.ReactorNettyClient - Connection Error
    io.netty.util.IllegalReferenceCountException: refCnt: 0
            at io.netty.buffer.AbstractByteBuf.ensureAccessible(AbstractByteBuf.java:1464)
            at io.netty.buffer.CompositeByteBuf.discardReadComponents(CompositeByteBuf.java:1733)
            at io.r2dbc.postgresql.message.backend.BackendMessageEnvelopeDecoder.lambda$apply$0(BackendMessageEnvelopeDecoder.java:69)
            at reactor.core.publisher.FluxCreate.subscribe(FluxCreate.java:94)
            at reactor.core.publisher.Flux.subscribe(Flux.java:8127)
    It looks like some kind of resource leak warning, because my code is running fine and SQL statement is executed correctly. If I run:
    databaseClient.delete().from("tab").matching(where("field").`is`(5)).then().awaitFirstOrNull()
    there is no exception. And there are no problems with other kind of queries (SELECT, INSERT, UPDATE). Is this my bug? Or is this probably a bug in
    spring boot
    or
    spring-r2dbc
    ?
    s
    • 2
    • 12
  • n

    nfrankel

    09/13/2019, 9:01 AM

    https://www.youtube.com/watch?v=f6a78mCrSeE▾

    👍 4
    s
    • 2
    • 4
  • x

    xenoterracide

    09/16/2019, 6:08 PM
    jackson isn’t recognizing my
    @JsonProperty
    data class RabbitMqUser(
        @JsonProperty("password_hash")
        val passwordHash: String,
        var tags: String = ""
    )
    any ideas why that might be?
    l
    • 2
    • 2
  • j

    Jason Feng

    09/18/2019, 6:14 AM
    Hi guys, what is the best practice for Spring Data JPA Entity written in Kotlin, using
    data class
    or
    class
    with
    lateinit var
    , those field in entity mostly don’t have default value
    t
    c
    +2
    • 5
    • 7
  • d

    deviant

    09/18/2019, 6:42 AM
    data class is preferable (see data class benefits). and
    middleName
    should be nullable type
    t
    k
    +2
    • 5
    • 7
  • j

    Jason Feng

    09/18/2019, 11:12 AM
    Thanks for all the help and links guys, much appreciated. After all the suggestions and in-depth links, if I understand it correct, the way to go is using the normal
    class
    with optional
    var
    properties, for the default
    constructor
    , take all the mandatory fields first, then the optional fields.
    s
    • 2
    • 1
  • t

    thanksforallthefish

    09/18/2019, 2:14 PM
    does springmockk allow to mock extension functions? (a bit of a stretch to ask here, as officially spring mockk is not associated with spring)
    m
    • 2
    • 7
  • d

    Dariusz Kuc

    09/18/2019, 4:10 PM
    hello, by any chance anyone knows whether it is possible to specify webflux WebFilter order from Java configuration (i.e. without
    @Component
    annotation), i.e. equivalent of servlet
    FilterRegistrationBean
    ?
    • 1
    • 1
  • m

    Manuel Lorenzo

    09/19/2019, 1:13 PM
    and how do I do in the Explore project to add more modules? currently I’m adding gradle modules manually to the app
    s
    c
    • 3
    • 3
  • s

    Slackbot

    09/19/2019, 2:53 PM
    This message was deleted.
    :thread-please: 1
    t
    s
    • 3
    • 16
  • r

    reik.schatz

    09/19/2019, 4:06 PM
    actually it’s alredy using
    spring-xyz-5.2.0.M2
    so I guess I have to stick with the 1.2.x version of the
    org.jetbrains.kotlinx
    libs
    s
    • 2
    • 11
  • d

    davidkarlsen

    09/19/2019, 5:31 PM
    the qualifier does not seem to be taken into consideration…
    l
    • 2
    • 21
  • j

    Jonas Bark

    09/23/2019, 7:54 AM
    In a
    coRouter
    context I'd like to use a
    TEXT_EVENT_STREAM
    like this:
    val flux: Flux<String> = loggingThing()
    return ok()
                .contentType(MediaType.TEXT_EVENT_STREAM)
                .body(result, String::class.java)
    but coRouter expects a
    ServerResponse
    and not a
    Mono<ServerResponse>
    .
    bodyAndAwait
    wouldn't work with
    Please specify the element class by using body(Publisher, Class)
    . Is such a thing supported out of the box with coRouter DSL or should I return to a standard router here? Using Spring Boot 2.1.6 (and coRouter implementation from 2.2.0-M6 I think)
    d
    s
    • 3
    • 6
  • s

    Slackbot

    09/23/2019, 2:27 PM
    This message was deleted.
    c
    s
    • 3
    • 8
  • l

    Luis Munoz

    09/24/2019, 3:12 PM
    Speaking of R2DBC, I was reading that making JDBC non blocking has insignificant benefits because the databases can only do so much at any given time, so if you have say a pool of 30 threads to do database calls, that is already more operations than the database can do concurrently anyway so making it non blocking will simply save you the overhead of the thread pool. So what is the big deal about nonblocking JDBC ? Anyone disagree?
    f
    d
    • 3
    • 2
  • d

    Dariusz Kuc

    09/26/2019, 4:25 AM
    hello! does anyone know what is the proper way to invoke coroutines from Spring WebFilters? e.g. something like this works and populates the context as expected
    class FooFilter : WebFilter {
        override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> = mono {
            foo()
        }.flatMap { foo ->
            chain.filter(exchange).subscriberContext { it.put("foo", foo) }
        }
        
        suspend fun foo(): Foo { ... }
    }
    • 1
    • 7
  • t

    thana

    09/26/2019, 8:45 AM
    how do you write entities in kotlin? i don't want ti declare any properties that are not nullable from a domain perspective nullable but OTOH also do not have default values for them hence i'd have to declare those variables in the primary constructor. But again this is not possible as spring data needs a parameterless constructor
    t
    d
    +2
    • 5
    • 10
  • k

    kschlesselmann

    09/26/2019, 2:11 PM
    Hi there! How would I treat (im)mutable collections in my Spring Data (Mongo) entities? I have the following setup
    @Document
    class Foo(
            test: Set<String>,
            val id: UUID = UUID.randomUUID()
    ) {
    
        private val _test: MutableSet<String> = test.toMutableSet()
    
        val test: Set<String>
            get() = _test
    
        override fun equals(other: Any?): Boolean {
            if (this === other) return true
            if (javaClass != other?.javaClass) return false
    
            other as Foo
            return id == other.id
        }
    
        override fun hashCode(): Int = id.hashCode()
    }
    
    @Repository
    interface FooRepository : ReactiveCrudRepository<Foo, UUID>
    along with the following test
    @DataMongoTest
    internal class MutableCollectionTest(
            @Autowired private val fooRepository: FooRepository
    ) {
    
        @Test
        fun `should save and retrieve Foo`() {
            // Given
            val foo = Foo(setOf("a", "b"))
    
            // When
            val result = fooRepository.save(foo)
                    .then(fooRepository.findById(foo.id))
    
            // Then
            StepVerifier.create(result)
                    .expectNext(foo)
                    .verifyComplete()
        }
    }
    and it fails with:
    No property test found on entity class ….Foo to bind constructor parameter to!
    t
    • 2
    • 3
  • s

    Slackbot

    09/27/2019, 4:49 PM
    This message was deleted.
    j
    • 2
    • 1
  • r

    rrader

    09/28/2019, 1:48 PM
    Is someone using https://github.com/micronaut-projects/micronaut-data ?
    s
    • 2
    • 1
  • j

    jbnizet

    09/29/2019, 8:28 AM
    I just published SpringMockK 1.1.3. https://github.com/Ninja-Squad/springmockk/releases/tag/1.1.3. It should be available in Maven Central soon. In case you wonder what SpringMockK is, it’s MockBean and SpyBean, but for MockK instead of Mockito.
    👍 7
    💯 1
    s
    • 2
    • 1
  • t

    todd.ginsberg

    10/02/2019, 2:49 PM
    Will anybody from here be at S1P in Austin next week? Let's say hi to one another!
    x
    s
    +2
    • 5
    • 7
  • s

    sdeleuze

    10/03/2019, 2:43 PM
    https://twitter.com/sdeleuze/status/1179768042722664448?s=20
    👍 8
    🎉 7
    👏 3
    n
    b
    c
    • 4
    • 8
  • r

    Robert Jaros

    10/08/2019, 11:07 AM
    I'm using Spring Boot 2.2.0.RC1
    s
    • 2
    • 1
  • r

    Robert Jaros

    10/08/2019, 12:28 PM
    what should i do to just handle the response inside my function?
    s
    • 2
    • 1
Powered by Linen
Title
r

Robert Jaros

10/08/2019, 12:28 PM
what should i do to just handle the response inside my function?
s

sdeleuze

10/10/2019, 3:42 AM
I guess use
@RestController
instead of
@Controller
as specified in the documentation.
View count: 3