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

    hho

    12/11/2017, 11:34 AM
    I had a similar issue. Given that the exception happens during initialization of the HttpMessageConverter, I think the Problem is with Jackson. Boot 1.5.9 provides Jackson 2.8.10 – I suggest you try upgrading to Jackson 2.9.2. That solved the issue for me.
    👍 3
    q
    • 2
    • 1
  • l

    lex

    12/27/2017, 3:44 AM
    @fabricio hi, can you show logs and error?
    q
    f
    • 3
    • 5
  • d

    dariuszbacinski

    01/10/2018, 3:45 PM
    I am using something like this to make any() matcher work with Kotlin:
    fun <T> anyObject(): T {
        Mockito.any<T>()
        return uninitialized()
    }
    
    private fun <T> uninitialized(): T = null as T
    z
    • 2
    • 1
  • s

    Sola

    01/17/2018, 8:46 AM
    I'm using kotlin-spring plugin and still get this error, but
    @RestController
    @Configuration
    works fine for me
    n
    • 2
    • 1
  • d

    dstarcev

    01/17/2018, 10:42 AM
    It works when I start it with
    ./gradlew bootRun
    , but still fails when I start it from IDEA
    l
    c
    +2
    • 5
    • 7
  • m

    megax

    01/17/2018, 6:57 PM
    @Around(" execution(hu..web.sync.controller.SomeController *(..))")
        fun auditInfo(joinPoint: ProceedingJoinPoint) {/*never arrive here*/}
    c
    d
    • 3
    • 9
  • d

    dharrigan

    01/18/2018, 11:29 AM
    plugins {                                                                                                                                                            
        val kotlinVersion = "1.2.20"                                                                                                                                     
        val springBootVersion = "1.5.9.RELEASE"                                                                                                                          
        val springDependencyManagementVersion = "1.0.4.RELEASE"                                                                                                          
                                                                                                                                                                         
        idea                                                                                                                                                             
        kotlin("jvm") version kotlinVersion                                                                                                                              
        id("io.spring.dependency-management") version springDependencyManagementVersion                                                                                  
        id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion                                                                                                   
        id("org.springframework.boot") version springBootVersion                                                                                                         
    }
    c
    • 2
    • 3
  • j

    Jacol

    01/24/2018, 11:27 AM
    @Pawel Urban 1. I have installed JDK1.8
    C:\Program Files\Java>java -version
    java version "1.8.0_161"
    Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
    
    C:\Program Files\Java>echo %JAVA_HOME%
    C:\Program Files\Java\jdk1.8.0_161
    2. my gradle
    buildscript {
    	ext {
    		kotlinVersion = '1.2.10'
    		springBootVersion = '2.0.0.M7'
    	}
    	repositories {
    		mavenCentral()
    		maven { url "<https://repo.spring.io/snapshot>" }
    		maven { url "<https://repo.spring.io/milestone>" }
    	}
    	dependencies {
    		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    		classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
    		classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
    	}
    }
    
    apply plugin: 'kotlin'
    apply plugin: 'kotlin-spring'
    apply plugin: 'eclipse'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'
    
    group = 'pl.app'
    version = '0.0.1-SNAPSHOT'
    sourceCompatibility = 1.8
    compileKotlin {
    	kotlinOptions.jvmTarget = "1.8"
    }
    compileTestKotlin {
    	kotlinOptions.jvmTarget = "1.8"
    }
    
    repositories {
    	mavenCentral()
    	maven { url "<https://repo.spring.io/snapshot>" }
    	maven { url "<https://repo.spring.io/milestone>" }
    }
    
    
    dependencies {
    	compile('org.springframework.boot:spring-boot-starter-data-jpa')
    	compile('org.springframework.boot:spring-boot-starter-web')
    	compile('org.springframework.boot:spring-boot-starter-webflux')
    	compile("org.jetbrains.kotlin:kotlin-stdlib-jre8")
    	compile("org.jetbrains.kotlin:kotlin-reflect")
    	runtime('com.h2database:h2')
    	testCompile('org.springframework.boot:spring-boot-starter-test')
    	testCompile('io.projectreactor:reactor-test')
    }
    c
    • 2
    • 4
  • p

    Pawel Urban

    01/24/2018, 11:38 AM
    ./gradlew eclipse
    and then open the project
    j
    • 2
    • 4
  • j

    Jacol

    01/24/2018, 11:46 AM
    when I use intellij
    Outdated Kotlin Runtime
    			Your version of Kotlin runtime in 'Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.1.61' library is 1.1.61-release-68 (1.1.61), while plugin version is 1.2.20-release-IJ2017.3-1.
    			Runtime library should be updated to avoid compatibility problems.
    but this running 🙂
    c
    s
    • 3
    • 7
  • f

    fabricio

    01/24/2018, 8:21 PM
    even If I remove all the configuration in the .yml I still get the error
    m
    • 2
    • 4
  • k

    ken.siprell

    01/26/2018, 3:47 PM
    Could someone take a look at my repo here: https://github.com/kensiprell/kotlin-spring-security? To summarize the README, I’m trying to use a
    BCryptPasswordEncoder
    bean to encode passwords, but whenever I create the bean, it breaks authentication. The details are in the repo’s README. Thanks!
    • 1
    • 2
  • h

    hho

    01/28/2018, 1:38 PM
    @fabricio @sdeleuze I had the exact same issue with 1.2.20 (Data source config not found) – the culprit seems to be the incremental compilation of the Kotlin compiler. It wipes the resources directory during compilation, so when you run the final JAR no properties/yaml are found. https://youtrack.jetbrains.com/issue/KT-21581 (& Duplicates)
    s
    • 2
    • 1
  • k

    kruczaj

    01/29/2018, 4:58 PM
    Hey. I'm sending notification for users via WebSocket, but previously I need to fetch some data from DB. I was thinking about doing both processes asynchronously, but I'm not sure if that is proper way of doing that.
    launch(CommonPool) {
    			sendNotifications(updatedItemsIds) // fetch data and send notification via WS
    		}
    Any thoughts on that?
    q
    • 2
    • 1
  • k

    kruczaj

    01/29/2018, 4:59 PM
    Maybe I should play around with
    @Async
    from Spring if that is better approach.
  • s

    starbuxman

    02/04/2018, 6:44 AM
    I learned something yesterday:
    @get:Bean val foo=Foo()
    👍 3
    n
    • 2
    • 1
  • c

    chintanshah

    02/05/2018, 7:33 AM
    Anyone knows why
    @RequestParam("size", required = false) size: Int = 5
    does not give
    size
    a default value?
    c
    • 2
    • 1
  • d

    dstarcev

    02/06/2018, 11:12 AM
    how do I check that a compiler plugin is applied when building via IDEA or with
    ./gradlew build
    ?
    n
    • 2
    • 1
  • m

    Martin Schwitalla

    02/08/2018, 6:39 PM
    I have a question. At work we are currently experimenting with Kotlin and Spring Boot. One of the nice things of Java and Spring Boot was, that if you had something like "public interface EventProcessor<T>" in Java you could autowire a list of classes that implement that interface. While trying to do this today with Kotlin it didn't work. Why is that so? And is there an alternative to do a similar thing "the kotlin way"? Currently we just transform the object and based on the type we execute a different processor. This is done via a "when (x)..." but that isn't as nice.
    n
    c
    • 3
    • 14
  • m

    Martin Schwitalla

    02/08/2018, 7:01 PM
    aaaah, so you can do something like <*>?
    c
    • 2
    • 8
  • k

    Kaj

    02/08/2018, 7:38 PM
    Does anyone know how I can let my Spring controller return a 404? I thought I could just return a nullable variable and if it is null Spring would translate it to a 404. Do I really need to use
    ResponseEntity
    specifically?
    n
    d
    +2
    • 5
    • 9
  • d

    dh44t

    02/09/2018, 10:41 AM
    My suggestion for now is too use an extension function
    f
    • 2
    • 1
  • f

    fitzoh

    02/12/2018, 2:20 PM
    Hey, for anyone using/interested in spring-cloud-contract, there’s an open issue/ongoing work on adding a kotlin DSL, take a look and add a comment if you have any feedback: https://github.com/spring-cloud/spring-cloud-contract/issues/434
    s
    • 2
    • 3
  • s

    sdeleuze

    02/13/2018, 10:57 AM
    @soudmaijer Done https://github.com/spring-cloud/spring-cloud-contract/issues/434#issuecomment-365229140
    s
    • 2
    • 7
  • b

    bkenn

    02/13/2018, 8:29 PM
    With the Spring Boot JPA, how can I tell Spring to use a .hbm.xml to declare a managed type and not use annotations? I have tried `spring.jpa.properties.hibernate.mappingLocations = classpath:/hibernate/.hbm.xml` but I still receive a
    Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.github.bkenn.jpafx.model.Vendor
    exception.
    :stackoverflow: 1
    n
    t
    • 3
    • 11
  • l

    leodeng

    02/14/2018, 8:14 PM
    i usually use
    @Autowired lateinit var dependency: Dependency
    ➕ 4
    m
    s
    d
    • 4
    • 11
  • s

    sdeleuze

    02/15/2018, 8:47 AM
    @ConfigurationProperties("foo")
    class FooProperties {
    	lateinit var foo1: String
    	lateinit var foo2: String
    	lateinit val bar = Bar()
    
    	class Bar {
    		lateinit var bar1: String
    		lateinit var bar2: String
    	}
    }
    c
    i
    • 3
    • 4
  • s

    sdeleuze

    02/15/2018, 11:11 AM
    Oh and feel free to submit Spring + Kotlin talks at https://www.kotlinconf.com/ (I won't submit myself)
    c
    s
    • 3
    • 5
  • k

    kenkyee

    02/15/2018, 11:19 AM
    That image is wrong..lol... from 2017
    s
    • 2
    • 1
  • p

    Pere Casafont

    02/26/2018, 3:11 AM
    in jpa, do you think it is a good choice to have not nullable primitive column attributes annotated with
    ?
    ? I use lateinit with non primitives, but I'm kind of uncomfortable having to initialize my ids to 0 or -1
    l
    • 2
    • 1
Powered by Linen
Title
p

Pere Casafont

02/26/2018, 3:11 AM
in jpa, do you think it is a good choice to have not nullable primitive column attributes annotated with
?
? I use lateinit with non primitives, but I'm kind of uncomfortable having to initialize my ids to 0 or -1
l

lovis

02/26/2018, 12:06 PM
i’d go for
?
, since you’ve got language features at hand to deal with it (
?.
,
!!
), while
-1
or
0
are kind of obscure.
View count: 3