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

    fabricio

    11/12/2018, 2:33 PM
    i`m trying to use
    <java.version>11</java.version>
    with kotlin. But I get this error:
    >> Error: Kotlin: Unknown JVM target version: 11
    Supported versions: 1.6, 1.8
    r
    c
    +3
    • 6
    • 12
  • b

    bdeg

    11/21/2018, 7:51 AM
    Can someone confirm if there's official support for coroutine and if it's safe to use it in production? Or any coroutine to FLux convertor?
    s
    • 2
    • 4
  • m

    Michael Gysel

    11/29/2018, 4:18 PM
    You need to actually allow requests from an origin:`registry.addMapping("/**").allowedOrigins("http://localhost:9000")`
    t
    • 2
    • 3
  • s

    sdeleuze

    11/29/2018, 5:00 PM
    Switch log level for
    DefaultCorsProcessor
    to
    TRACE
    t
    • 2
    • 1
  • b

    bdeg

    11/29/2018, 5:32 PM
    Hi, I'm building a multiplatform side project in kotlin. I have decided to use spring as my backend, because our backend team use it and I have used it in the past. I'm trying to build an authentication system using spring security, spring security will delegate authentication to my firebase Auth manager from the firebase java admin sdk. I have done some research, and discovered 3 approach for custom authentication using spring security: 1- user detail services. 2- authentication provider. 3- authentication manager. 4- simply by setting the authenticated user in the security context holder. My first question is what's the recommended approach to custom authentication system? Second question is there a way to use my own domain object for authentication? I known that I can use the user detail interface but I think that returning my user identifier or email in the getUsername method introduce confusion in my source code. So is there's another way to use my domain object?
    d
    j
    i
    • 4
    • 21
  • t

    tjb

    12/02/2018, 7:48 AM
    @Configuration
    @EnableAuthorizationServer
    class AuthServerConfig(@Value("\${test.oauth.tokenTimeout:3600}")
                           var expiration: Int): AuthorizationServerConfigurerAdapter() {
    
        @Autowired lateinit var userDetailsService: UserDetailsService
        @Autowired lateinit var authenticationManager: AuthenticationManager
    
        @Bean fun passwordEncoder(): PasswordEncoder {
            return BCryptPasswordEncoder()
        }
    
        override fun configure(configurer: AuthorizationServerEndpointsConfigurer) {
            configurer.authenticationManager(authenticationManager)
            configurer.userDetailsService(userDetailsService)
        }
    
        override fun configure(clients: ClientDetailsServiceConfigurer) {
            clients
                    .inMemory()
                    .withClient("test") // TODO: Set to settings in application.yml
                    .accessTokenValiditySeconds(expiration)
                    .scopes("read", "write")
                    .authorizedGrantTypes("password", "refresh_token")
        }
    }
    i
    • 2
    • 5
  • c

    Czar

    12/09/2018, 2:23 PM
    which jsr305 dependency should I use for spring boot 2.1.1 kotlin 1.3.11 (with some java8 classes) project?
    s
    t
    • 3
    • 8
  • r

    rodolpho.couto

    12/12/2018, 7:21 PM
    Anyone using Spring WebFlux + Transaction Manager here? Is it possible to synchronize an atomic transaction between multiple threads?
    s
    • 2
    • 5
  • l

    lewik

    12/20/2018, 8:12 PM
    I am using Spring Boot 2, Spring Integration and kotlin. Got
    Resource not found in classpath: kotlin/coroutines/coroutines.kotlin_builtins
    No coroutines in m code What dependency I should add?
    s
    • 2
    • 11
  • t

    Tristan Caron

    12/21/2018, 10:48 AM
    Hello, Is it possible to use Spring WebFlux and Spring MVC in the same project. We would like to migrate step by step.
    s
    • 2
    • 5
  • e

    Evgeniy Zaharov

    12/21/2018, 12:26 PM
    Hi, is it ok to use suspend function in bean public methods? Special in Webflux version..
    s
    • 2
    • 9
  • t

    thanksforallthefish

    12/21/2018, 12:55 PM
    I was reading https://dzone.com/articles/mixins-with-kotlin, and I find the part with jpa quite interesting. however, it does not seem to work with spring data in the mix, because of the way annotations are checked (I tried with auditing). should I try to create a sample project and maybe open a jira or is it something already known?
    s
    • 2
    • 2
  • s

    Slackbot

    12/23/2018, 11:20 PM
    This message was deleted.
    c
    • 2
    • 3
  • d

    davidkarlsen

    12/30/2018, 8:25 PM
    I have this code in kotlin:
    Mockito.`when`(ccmService.getApplication(Mockito.eq(appName), Mockito.eq(finodsGroup)))
                    .thenReturn(Optional.of(Application(
                            0L,
                            appName,
                            "",
                            email, null, "jfr", "EOS", email, employee, employee, employee, employee)))
    but I get
    -> at com.evry.fs.arch.icpautomate.automator.AutomatorServiceTest.testCreateNamespace(AutomatorServiceTest.kt:39)
    
    You cannot use argument matchers outside of verification or stubbing.
    Examples of correct usage of argument matchers:
        when(mock.get(anyInt())).thenReturn(null);
        doThrow(new RuntimeException()).when(mock).someVoidMethod(anyObject());
        verify(mock).someMethod(contains("foo"))
    
    This message may appear after an NullPointerException if the last matcher is returning an object 
    like any() but the stubbed method signature expect a primitive argument, in this case,
    use primitive alternatives.
        when(mock.get(any())); // bad use, will raise NPE
        when(mock.get(anyInt())); // correct usage use
    the mock is injected with:
    @MockBean(name = "ccmServiceImpl")
        lateinit var ccmService: CcmService
    m
    p
    • 3
    • 3
  • n

    Nimelrian

    01/04/2019, 7:07 PM
    I created a new project consisting of a library and an application (which uses the library) using the guides at https://spring.io/guides/tutorials/spring-boot-kotlin/ and https://spring.io/guides/gs/multi-module/. I also upgraded the Kotlin version to 1.3.11. Building the project and running the resulting jar works just fine. However, when building the library, the test task fails due to the following exception being thrown during the initialization of my service:
    ...
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modelService' defined in file [G:\src\java\afraid\model\build\classes\kotlin\main\de\nimelrian\afraid\model\ModelService.class]: Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: Resource not found in classpath: kotlin/coroutines/coroutines.kotlin_builtins
    Caused by: java.lang.IllegalStateException: Resource not found in classpath: kotlin/coroutines/coroutines.kotlin_builtins
    ...
    I have a reproduction repository here: https://github.com/Nimelrian/kotlin-1.3-spring-test-error Running
    .\gradlew build
    should show the failing test. Gradle also shows some warnings regarding differing versions, so I tried pinning the versions using the dependency management plugin, which makes both the warnings and the test error disappear (See the
    potential-fix
    branch in the repo). I do wonder whether this is the correct way though.
    c
    • 2
    • 9
  • s

    s1m0nw1

    01/07/2019, 6:02 PM
    A way to use @MockBean is still missing I think, i.e.
    @MockKBean
    💯 1
    s
    • 2
    • 2
  • v

    varpa89

    01/07/2019, 6:43 PM
    @sdeleuze I'm trying to use spring-fu-webflux-coroutines and when make an http request with coroutinesWebClient.get().uri("https://foo.bar").exchange() I get https://github.com/spring-projects/spring-fu/blob/9ab305aec3d89002e10c6a02d4203b58be70334d/coroutines/webflux/src/main/kotlin/org/springframework/web/function/client/CoroutinesClientResponse.kt#L21 but there is no any methods for retrieve the result body, headers, status. What I'm doing wrong? Thx
    s
    • 2
    • 4
  • p

    poohbar

    01/08/2019, 2:35 AM
    @sdeleuze I have been using MockK for testing my Spring Boot app for months and had very few issues. Not much required really.
    s
    • 2
    • 1
  • r

    reik.schatz

    01/08/2019, 9:31 AM
    I have changed some unit tests from the
    lateinit var
    way to the
    @Autowired val
    constructor way (junit5). one test class with 4 test method can now only execute 1 test method successfully. the other ones are failing with
    No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
    . What makes this test class different, is a
    @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
    annotation. I am also running with
    junit.jupiter.testinstance.lifecycle.default=per_class
    . Maybe all of this doesn’t play nice together?
    s
    • 2
    • 5
  • p

    Pankaj

    01/08/2019, 5:23 PM
    Is there a good way of performance testing a spring boot app via automted junit tests? Multiple requests and users etc?
    n
    • 2
    • 2
  • o

    orangy

    01/09/2019, 8:33 PM
    https://twitter.com/springops/status/1083050426650357760
    😱 1
    👍 3
    🎉 2
    👏 2
    s
    • 2
    • 1
  • d

    dh44t

    01/11/2019, 7:27 AM
    Hi folks, Just to let you know that we wrote a very complex migration process using Spring Boot, Spring Shell, Kotlin, Arrow, Reactor and I’m very impressed how it turns out, very fast and clean Kudos to @sdeleuze and the other guys/gals contributing to the Kotlin integration on Spring/Reactor projects
    s
    • 2
    • 1
  • d

    davidkarlsen

    01/11/2019, 1:47 PM
    specifically kotlin dataclasses
    t
    • 2
    • 4
  • s

    Slackbot

    01/14/2019, 1:37 PM
    This message was deleted.
    :stackoverflow: 1
    😕 1
    n
    • 2
    • 1
  • l

    Lucas

    01/15/2019, 3:34 AM
    Could you help me writing this line using Kotlin? IntelliJ shows type inference error and It's not clear to me what type the `apply`function receive. https://github.com/spring-projects/spring-security/blob/master/samples/boot/hellowebflux-method/src/test/java/sample/HelloWebfluxMethodApplicationTests.java#L47
    c
    • 2
    • 3
  • h

    hennilu

    01/18/2019, 4:53 PM
    has anyone a working example of using @Autowired to inject MockMvc in order to test a RestController? Using JUnit 5.3.0, SpringBoot 2.1.2 and kotlin 1.3?
    m
    t
    l
    • 4
    • 10
  • a

    ander.dev

    01/22/2019, 5:27 AM
    whats up guys......sorry but I could not find another place to ask it...have been googling this issue for a while, probable using wrong key words. I using kotling with springboot in my backend app, which is just perfect, but there is one thing that I cant find a answer on the web, if some of you can help... So, in my UserServiceImpl.kt I have a save method that is using save from CrudRepository; My user table has a constraint for emails but even though I have a try catch on the save method it does not catch the exception
    -.txt
    l
    • 2
    • 6
  • a

    ander.dev

    01/22/2019, 5:28 AM
    kotlin_version = '1.3.11' spring_boot_version = '2.1.0.RELEASE'
    s
    b
    • 3
    • 3
  • s

    sdeleuze

    01/23/2019, 10:39 AM
    On the caller side I would suggest using
    WebClient
    which is the reactive web client usable with both Spring WebFlux and Spring MVC servers. I am actively working on Coroutines support which will be available in experimental mode shortly, and in a fully supported fashion in Spring Boot 2.2. For now, you should use
    WebClient
    Reactive API IMO.
    r
    • 2
    • 9
  • m

    masc3d

    01/24/2019, 5:05 PM
    would this be an issue in spring’s kt support?
    s
    • 2
    • 9
Powered by Linen
Title
m

masc3d

01/24/2019, 5:05 PM
would this be an issue in spring’s kt support?
s

sdeleuze

01/28/2019, 1:28 PM
Could you please provide a repro project to allow me to have a look ?
m

masc3d

01/29/2019, 11:29 AM
seems tricky. setting up similar test based on https://github.com/dnno/spring-kotlin-jpa I couldn’t replicate it
I see a difference in proxy comparing invoked object
example uses plain
com.sun.proxy
ours is based on cglib
any hint how to enforce use of cglib in example? I believe this may be key to repro
nevermind, it’s not related to cglib
occurs only with exceptions that are not
RuntimeException
https://github.com/masc3d/spring-kotlin-jpa
you can use
JpaCityServiceTest
to replicate, it will fail on several tests with
UndeclaredThrowableException
https://github.com/spring-projects/spring-framework/issues/22412
View count: 11