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

    Robert Jaros

    10/08/2019, 1:39 PM
    No luck with this ... I've finally thrown this annotated controller stuff away completely and moved to functional approach. It works fine now 🙂
    s
    • 2
    • 3
  • r

    Robert Jaros

    10/09/2019, 5:13 PM
    no one ever tested this?
    s
    • 2
    • 1
  • s

    Slackbot

    10/11/2019, 9:32 AM
    This message was deleted.
    f
    k
    s
    • 4
    • 5
  • b

    bjonnh

    10/11/2019, 7:46 PM
    https://pastebin.com/xQSUVGHc
    • 1
    • 1
  • r

    Robert Menke

    10/11/2019, 10:37 PM
    You’re probably not leveraging the functional nature of Kotlin, which is, in my opinion, the greatest advantage. Kotlin is more expressive, more concise, safer, and truly multi-paradigm. Honestly I’ve yet to hear a good reason why sticking with java is rational. It’s usually just people that want to stick with what they already know.
    a
    • 2
    • 5
  • x

    xenoterracide

    10/11/2019, 10:43 PM
    on SAM, for example if something defines java.util.function.Function as a parameter, you then have to write
    myMethod Function { foo -> bar }
    in kotlin to pass the function, in java that would just be
    myMethod( foo -> bar )
    e
    • 2
    • 5
  • r

    rrader

    10/13/2019, 10:07 AM
    How do you handle this situation https://github.com/spring-projects/spring-framework/issues/23789 ?
    m
    j
    • 3
    • 5
  • g

    Gabriel Machado

    10/14/2019, 3:50 PM
    Is there a version of
    spring-boot-starter-webflux
    with the new coroutines support? Or I need to manually include dependencies such as
    'spring-webflux', version: '5.2.0.M2'
    ?
    r
    • 2
    • 5
  • m

    Marko Mitic

    10/15/2019, 11:41 AM
    Does anyone know when SpringOne Platform 2019 recordings are going to be available? https://kotlinlang.slack.com/archives/C0922A726/p1571137314272600
    👍 1
    m
    l
    • 3
    • 4
  • j

    jmfayard

    10/16/2019, 8:59 AM
    This is really nice https://speakerdeck.com/elizarov/spring-flavored-kotlin-coroutines
    ❤️ 5
    😒uspend: 3
    g
    • 2
    • 1
  • b

    Bernhard

    10/17/2019, 2:45 PM
    upgraded to spring boot 2.2 today and it supports @ConfigurationProperties for data classes, but how do I get rid of intellij warning me about the configuration processor not being on classpath?
    s
    m
    • 3
    • 4
  • b

    bjonnh

    10/18/2019, 6:08 PM
    Do we have any stats on the pick up of Kotlin in the Spring world?
    s
    n
    +6
    • 9
    • 27
  • p

    Peter

    10/22/2019, 6:01 PM
    Hello everyone, A bit about me then the question: I use Kotlin almost 5 months now. I have been programming for about 2 years total(1.5 year trying to learn Java - spring, 5 months professionally). Currently I am using Kotlin with Spring Batch & Boot. All this time I have been skipping Concurrency "for later" and I think the time has come now. I am thinking If you guys as most experienced individuals, would suggest I skip Java concurrency and dive directly to Kotlin concurrency/coroutines? Will I miss "important background" if I do that, or is it completely normal to start my journey with kotlin? Thanks. p.s. Sorry If this should go to #getting-started. I ll post there as well.
    x
    a
    • 3
    • 3
  • b

    bjonnh

    10/22/2019, 7:34 PM
    I have an architecture question. Is there a spring-friendly approach for triggering long-running tasks? (through http for example). I would like to be able to query if that task is still running, failed, etc
    m
    • 2
    • 8
  • m

    mister11

    10/23/2019, 8:02 AM
    How much issues can blocking API calls cause in a WebFlux app if they are scheduled using
    Schedulers.boundedElastic()
    scheduler? At the moment, I have only some DB calls using JOOQ, but I might use some other blocking library. I've added
    BlockHound
    to the project and once I moved DB calls to a separate scheduler it stoped reporting blocking calls, but I'm aware that number of available threads is much smaller in Netty than in Tomcat which might cause scalability issues down the road.
    l
    • 2
    • 1
  • m

    Marcel Overdijk

    10/31/2019, 10:34 PM
    class MdcTaskDecorator implements TaskDecorator {
    
      @Override
      public Runnable decorate(Runnable runnable) {
        // Right now: Web thread context !
        // (Grab the current thread MDC data)
        Map<String, String> contextMap = MDC.getCopyOfContextMap();
        return () -> {
          try {
            // Right now: @Async thread context !
            // (Restore the Web thread context's MDC data)
            MDC.setContextMap(contextMap);
            runnable.run();
          } finally {
            MDC.clear();
          }
        };
      }
    }
    t
    • 2
    • 1
  • m

    Marcel Overdijk

    10/31/2019, 10:36 PM
    @Configuration
    @EnableAsync
    class AsynchConfig : AsyncConfigurerSupport() {
    
        override fun getAsyncExecutor(): Executor {
            val executor = ThreadPoolTaskExecutor()
            executor.setTaskDecorator(MDCTaskDecorator())
            executor.initialize()
            return executor
        }
    }
    j
    • 2
    • 5
  • o

    Or Cohen

    11/03/2019, 12:50 PM
    Hey guys. I’m Working on a Kotlin + Spring Boot 2.2 app (non reactive). I recently converted my routing definition to Kotlin DSL with
    WebMvc.fn
    instead of using
    @RequestMapping
    annotations. Since I’m now using request handlers rather than controllers, my controller unit tests (
    MockMvc
    with standalone setup) are obviously failing 🙂 I’m trying to fix my unit tests but I’m struggling making things work. Seems like every request I’m making using
    MockMvc
    (without standalone steup this time) ends up with 404. When I run my app or my integration tests, everything works just fine, so I’m guessing it’s somehow related to the routes bean not being loaded to the app context. Failed to work around it though. Any ideas? am I missing something?
    m
    s
    • 3
    • 6
  • c

    cpe

    11/04/2019, 9:09 PM
    Hey, I've got a question about the new Spring Router DSL. I am migrating an application from the traditional Mappings and struggling on a POST from a web form containing an array for a value, let's say like this:
    <form name="users" action="POST">
    <input type="text" name="someInfo">
    <input type="text" name="users[name][0]">
    <input type="text" name="users[surname][0]">
    <input type="text" name="users[name][1]">
    <input type="text" name="users[surname][1]">
    </form>
    
    data class InputForm(val someInfo: String, val users: Map<String, List<String>)
    which could be wired like this:
    @PostMapping("/users")
    fun updateUsers(inputForm: InputForm) {
      // access input form data like "someInfo" and the map "user"
    }
    With the migration I have something like:
    router {
      POST("/users", userController::updateUsers)
    }
    
    fun updateUsers(request: ServerRequest): ServerResponse {
      val inputForm = request.body<InputForm>()
      // do some stuff
      return ServerResponse.ok().render("success.html")
    }
    This is causing the following exception:
    org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
    What is the correct way to read the message in an automated way like it was possible with the traditional mapping? Or do I need to write a custom HttpMessageConverter?
    m
    s
    • 3
    • 9
  • j

    joshr

    11/05/2019, 2:49 AM
    on this branch, though, i get the following:
    • 1
    • 1
  • j

    joshr

    11/05/2019, 2:50 AM
    the only difference is that i split out the usercontroller and articlecontroller tests into separate test classes
    • 1
    • 1
  • h

    Hullaballoonatic

    11/05/2019, 7:05 PM
    Is there a more succinct way to initialize properties of a configuration from a properties file than this?
    @Configuration
    class FooConfiguration {
        @Value("\${foo.bar}")
        lateinit var bar: String
    }
    This just seems really verbose, even compared to the java way, and I tend to prefer lazy delegation val over lateinit var for immutable properties like this.
    d
    j
    • 3
    • 27
  • n

    nicholasnet

    11/07/2019, 12:16 PM
    Can you use coroutine in Spring JPA does it adds any benefit?
    s
    • 2
    • 1
  • h

    Hullaballoonatic

    11/07/2019, 6:55 PM
    I feel like if spring was written using kotlin originally, it would just use objects a lot instead of injection, but that's because i'm under the impression that beans are just singletons
    s
    f
    +2
    • 5
    • 13
  • f

    Frodrigues

    11/13/2019, 9:17 AM
    Why don't they use directly the getters and instead use suppliers?
    l
    • 2
    • 1
  • d

    Dariusz Kuc

    11/13/2019, 7:00 PM
    hello! I'm trying to create configuration property metadata (https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-configuration-metadata.html) for a map of objects, e.g.
    myProps:
      configs:
        someName:
          x: "foo"
          y: 1
        anotherName:
          x: "bar"
          y: 2
    that can be mapped to something like
    @ConstructorBinding
    @ConfigurationProperties(prefix = "myProps")
    data class MyProperties(val configs: Map<String, MyCustomProperties>)
    
    data class MyCustomProperties(val x: String, val y: Int)
    This seems to work fine and properties are loaded correctly in the application context but I don't get any auto-completion in the yml/properties files for
    MyCustomProperties
    . Anyone knows whether it is possible to somehow provide the configuration metadata for the above that IntelliJ is able to understand?
    • 1
    • 1
  • g

    Gary

    11/14/2019, 4:59 AM
    We're currently migrating our
    Webflux
    project to Co-routines. Loving the increased readability of co-routines and the simplicity of
    async/await
    , great job @sdeleuzeand team. But under the hood we're wondering should we expect any performance differences? If so in what circumstances is this likely to be evident?
    p
    s
    • 3
    • 4
  • s

    soudmaijer

    11/14/2019, 12:47 PM
    Question, I was wondering how I can make use of the BeanDefinitionDsl in my WebMvcTest to replace my @TestConfiguration class. Any examples? Or stupid question 😉
    n
    • 2
    • 3
  • t

    thiagoretondar

    11/14/2019, 9:35 PM
    has anyone had this problem on
    ./gradlew bootJar
    ? (not using intellij, it is in my CI/CD)
    * What went wrong: 
    Plugin [id: 'org.springframework.boot', version: '2.1.4.RELEASE'] was not found in any of the following sources: 
     
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) 
    - Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.1.4.RELEASE') 
      Searched in the following repositories: 
        Gradle Central Plugin Repository
    e
    b
    • 3
    • 13
  • m

    magisu

    11/17/2019, 7:03 PM
    message has been deleted
    a
    • 2
    • 1
Powered by Linen
Title
m

magisu

11/17/2019, 7:03 PM
message has been deleted
a

adamd

11/18/2019, 4:36 PM
And what is the problem with Kotlin?
InputStream
does not work?
View count: 9