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
server
  • m

    Mark Iantorno

    07/15/2020, 12:38 PM
    Hey everyone, I’m just looking for some advice on how to set up this project I’m working on. I need to stand up a server with an exposed API other applications can hit, with a front end gui that users can interact with. In addition to being able to deploy this as a server on VM, I need to be able to package the whole thing as a standalone application users can run locally on windows, linux, and osx when they don’t have access to the internet. I was thinking of using ktor as the back end and kotlin js for the front end, but I want to make sure I’m setting the project up correctly. If I use the default Kotlin ->
    JS Client and JVM Server | Gradle
    new project setup in IntelliJ, will this provide the project structure necessary for these requirements? Or is there a better starter project to use? Also, has anyone had experience doing this kind of dual purpose project? One that needs to be deployed as a stand-alone server with a front end, and also needs to be packaged as an application that can be run locally without internet? Any advice would be greatly appreciated. I think I have a good idea on where to start after reading though a bunch of the documentation, I just want to make sure I’m not missing anything.
    g
    j
    j
    • 4
    • 21
  • j

    jimn

    07/23/2020, 2:35 AM
    has anyone seen/fixed this in thier travels?
    Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: kotlin.KotlinPackage. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
    s
    • 2
    • 3
  • s

    Slackbot

    07/25/2020, 4:12 AM
    This message was deleted.
    a
    • 2
    • 1
  • s

    Slackbot

    07/29/2020, 2:00 PM
    This message was deleted.
    b
    • 2
    • 1
  • r

    ReddyTintaya

    07/30/2020, 5:10 PM
    Hi, i'm doing an e commerce with the backend in spring and for recipes i'm returning mimeMessage emails but i'm building my htmls as strings dynamically, so it's a hard string process ... is there any library that you've used and recommend for doing this?
    m
    j
    +2
    • 5
    • 7
  • r

    Raphael Ndonga

    08/02/2020, 11:41 AM
    Hello devs! Any advice for a kotlin android developer who wants to get started with KTOR?
    f
    • 2
    • 1
  • g

    Gopal Kalyanaraman

    08/04/2020, 1:39 PM
    Hi Iam trying to use maven to compile my spring boot kotlin set up..
    d
    • 2
    • 2
  • j

    Jilles van Gurp

    08/04/2020, 3:51 PM
    Try generating a pom or gradle file: https://start.spring.io/ there are kotlin options there.
    m
    • 2
    • 3
  • s

    sean

    08/07/2020, 3:16 PM
    Anyone familiar with the latest on lombok + kotlin? For reference, we have a very large java codebase with lombok littered all over and it makes introducing Kotlin very difficult since — as far as I can tell — in mixed java/kotlin source modules, there's no way to get the kotlin compiler to see the lombok generated code. I would love to be wrong about that though. Does anyone have experience with this or has found a smooth way around it?
    c
    s
    +4
    • 7
    • 12
  • e

    eddMX

    08/07/2020, 6:10 PM
    Hi, how can you control the http responses? Example If it is a 400 or 500. Return a custom message
    a
    t
    • 3
    • 15
  • n

    Nizan

    08/16/2020, 2:40 PM
    Hi, Someone knows a cache on spring framework for Kotlin reactive coroutines? I’m using suspended functions and it seems not to work with spring cache
    r
    a
    • 3
    • 2
  • m

    Markus Loide

    08/18/2020, 11:13 AM
    Hi everyone, I hope I'm not asking in the wrong channel, but I just tried updating to Kotlin 1.4 in my Spring Boot project, but I'm seeing a
    java.lang.NoClassDefFoundError: Could not initialize class kotlin.reflect.jvm.internal.impl.builtins.jvm.JavaToKotlinClassMap
    . Without posting the full stacktrace, the problem arises from the
    SpringApplication.run
    method, so it's not some personal code that is running it. (I'm using Spring Boot 2.2.x for this)
    m
    a
    • 3
    • 5
  • s

    Sushant Gawali

    08/19/2020, 4:44 AM
    Does anybody implemented REST api with partial responses in micronaut or kotlin ?
    a
    • 2
    • 2
  • a

    Ayodele

    08/21/2020, 11:59 AM
    Hi guys please has anyone done sms verification witth springboot? I want to set up signing up a new user, so it needs to send an otp to the user phone number for verification
    :stackoverflow: 4
    d
    a
    • 3
    • 3
  • m

    Marcel Champagne

    08/22/2020, 1:32 AM
    Hi all, I'm trying out Ktor for the first time and immediately running into issues. I'm just trying to follow the basis HTTP client setup. I used the Kotlin Intellij Plugin and everything builds fine but the second I try to make a get request I'm getting an error. The following code doesn't compile with line 16, but does without:
    14 fun Application.module(testing: Boolean = false) {
    15    val client = HttpClient(CIO)
    16    val htmlContent = client.get<String>("<https://en.wikipedia.org/wiki/Main_Page>")
    17 }
    But I the the following error
    Error:(16, 30) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
    public inline operator fun <K, V> Map<out String, [ERROR : Explicit type argument expected for V]>.get(key: String): [ERROR : Explicit type argument expected for V]? defined in kotlin.collections
    public operator fun MatchGroupCollection.get(name: String): MatchGroup? defined in kotlin.text
    m
    • 2
    • 2
  • l

    Lars Krog-Jensen

    08/23/2020, 5:38 AM
    [Ktor] Is it possible to configure ktor/netty to support http/2 cleartext (h2c)?
    c
    • 2
    • 2
  • a

    Alexa_Gal

    08/24/2020, 8:42 AM
    Does anybody know a good lib for socket with kotlin?
    a
    • 2
    • 3
  • d

    DosExe

    08/24/2020, 1:36 PM
    Hi, I have a problem with spring boot 2.1.6 I tried to use kotlin bean dsl to declare beans and it works perfectly fine for the core app, but tests are failing (for tests I am using spring-boot-starter-test and kotest). I have read all the information I could find on stackoverflow and made these improvements: 1. Created
    class BeansInitializer : ApplicationContextInitializer<GenericApplicationContext> {
       override fun initialize(context: GenericApplicationContext) {
           beans().initialize(context)
       }
    }
    2. Set context.initializer.classes=com.package.BeansInitializer in application.properties It helped a little bit, now some of the beans are created, but all beans with @ConfigurationsProperties are still not created.
    k
    • 2
    • 1
  • j

    Jilles van Gurp

    08/25/2020, 10:43 AM
    I spent a bit of time figuring out how to do a security filter with Kotlin, Spring Boot, and Flux: https://dev.to/jillesvangurp/reactive-security-filter-with-spring-kotlin-1ajo
    a
    • 2
    • 1
  • r

    Ryan Simon

    08/25/2020, 11:10 PM
    hey Kotlin server folks! i'm working with Ktor + Exposed to manipulate a database, and i've come across a dilemma related to architecture. with Exposed, it seems that the way Entities are designed is that they are not really meant to be transformed to domain models unless you transform all the relationships at once. for example, we have a few properties that are referenced via another table using
    referencedOn
    . These are properties that are fetched lazily.
    object ClassEquipments : IntIdTable("class_equipments") {
      val equipmentId = integer("equipment_id").entityId().references(Equipments.id)
      val classId = integer("class_id").entityId().references(Classes.id)
      val createdAt = timestamp("created_at").default(Instant.now())
      val updatedAt = timestamp("updated_at").default(Instant.now())
    
      init {
        index("ce_class_id_equipment_id", true, classId, equipmentId)
      }
    }
    
    class ClassEquipmentEntity(id: EntityID<Int>) : IntEntity(id) {
      companion object : IntEntityClass<ClassEquipmentEntity>(ClassEquipments)
    
      var equipmentId by ClassEquipments.equipmentId
      var classId by ClassEquipments.classId
      val createdAt by ClassRatings.createdAt
      var updatedAt by ClassRatings.updatedAt
      val equipment by EquipmentEntity referencedOn Equipments.id
      val clazz by ClassEntity referencedOn Classes.id
    }
    Our transformation extension looks like this
    fun ClassEquipmentEntity.toModel(): ClassEquipment = ClassEquipment(
        id = id.value,
        equipmentId = equipmentId.value,
        classId = classId.value,
        clazz = clazz.toModel(),
        equipment = equipment.toModel(),
        updatedAt = updatedAt.offsetDateTime,
        createdAt = createdAt.offsetDateTime
    )
    We convert everything at once. If we always wanted a
    clazz
    and an
    equipment
    this would be fine. There are times, however, that we don't want these objects. Now, this could be a question of premature optimization, but I'm wondering if anyone has been able to have a nice data class representation of a domain model that also allows the flexibility to load relationships on demand? Or maybe this approach is flawed somehow? Really curious to hear from anyone familiar with this. Thanks in advance!
    m
    j
    +2
    • 5
    • 14
  • m

    muliyul

    08/27/2020, 4:09 PM
    Kotlin wizards let me hear ya. I'm using dropwizard and I was wondering if it's possible to convert Jersey's
    AsyncResponse
    to a suspend function (supporting resource
    suspend
    functions transparently). Existing:
    class SomeResource {
      @GET
      fun someMethod(@Suspended asyncResponse: AsyncResponse) { ... }
    }
    Desired:
    class SomeResource {
      @GET
      suspend fun someMethod() { ... }
    }
    s
    t
    j
    • 4
    • 18
  • m

    Mathias Rørvik

    08/28/2020, 10:25 PM
    Hey! I became pretty enraged with ktor this week. More specifically content negation with Gson. I think the mention of Gson should be removed entirely from the docs, or at the very least get a big fat warning label. Gson does not respect null safety in Kotlin. If an incoming JSON object is missing fields, Gson will not throw an error, but rather populate the field in the corresponding data class with null. Apparently is been like this for a long time, and I don’t think the gson team plans on addressing this..
    ➕ 1
    😂 2
    z
    j
    +5
    • 8
    • 18
  • j

    Jan Špidlen

    08/29/2020, 8:45 AM
    just updated to kotliin 1.4. and when using
    ?:
    for a nullable list I get this... (see screenshot). Known issue?
    n
    • 2
    • 2
  • a

    Ayodele

    08/29/2020, 9:10 AM
    Hi guys I'm having issues with the mapstruct mapper in springboot
    @Mapper
    @Component
    interface UserMapper {
        fun toUserDTO(user: User): UserDTO
        fun toListOfUserDTO(users: List<User>) : List<UserDTO>
        fun toUser(userDTO: UserDTO) : User
        fun toListOfUser(userDTOs: List<UserDTO>) : List<User>
    }
    and i'm using it in my contoller
    @Autowired
    lateinit var userMapper: UserMapper
    It gives this error, please help
    ***************************
    APPLICATION FAILED TO START *************************** Description: Field userMapper in com.scienta.backend_rated_ng.controller.AuthController required a bean of type 'com.scienta.backend_rated_ng.mapper.UserMapper' that could not be found. The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.scienta.backend_rated_ng.mapper.UserMapper' in your configuration.
    d
    • 2
    • 2
  • r

    rrva

    09/02/2020, 10:00 AM
    is anyone out there using the jdk9+ java.net.http.HttpClient with sendAsync in combination with CompletionStage<T>.await() to make it suspendable? https://www.javaspecialists.eu/archive/Issue271.html got me thinking on the scalability of this solution… parts of the http requests are now executed on the common forkjoinpool threads and parts of it are awaited by coroutine executors.. 🤔
    a
    • 2
    • 19
  • a

    AlexJuca

    09/02/2020, 4:05 PM
    Idiomatic kotlin preconditions for spring boot Restful API's I would love your feedback on this. If you could contribute any ideas by creating issues and providing constructive feedback, it would be immensely helpful. https://github.com/nextbss/requirekt
    :kotlin: 1
    🎉 1
    ⭐ 1
    n
    k
    m
    • 4
    • 15
  • s

    Shalaga44

    09/05/2020, 1:57 PM
    Hi, I'm newbie trying to use KMP to build a full stack web app using Ktor in jvmMain as back-end and Kotlin-React in jsMain as front-end, How can I add all jsMain source set to ktor watch path to enable automatic reload .
    fun main() {
        embeddedServer(
            Netty, watchPaths = listOf("jvmMain"), port = 8080,
            module = Application::myModule
        ).start(wait = true)
    }
    fun Application.myModule() {
        routing {
            get("/") {
                call.respondHtml(HttpStatusCode.OK, HTML::index)
            }
            static("/static") {
                resources()
            }
        }
    }
    b
    • 2
    • 2
  • f

    fkrauthan

    09/06/2020, 10:17 PM
    Hey does anyone know a good AMQP library that works well with coroutines?
    r
    m
    l
    • 4
    • 6
  • f

    fkrauthan

    09/07/2020, 12:23 AM
    And what would you guys recommend for job scheduling (I am using ktor for the main application) but have a bunch of tasks that need to be executed in certain intervals
    f
    m
    • 3
    • 6
  • e

    Emmanuel Oga

    09/08/2020, 3:39 AM
    I'm curious if people here are using Jooby. Got nice techempower scores (fwiw) and seems to have good Kotlin support (although I haven't seen a Jooby room in this slack)
    m
    a
    • 3
    • 8
Powered by Linen
Title
e

Emmanuel Oga

09/08/2020, 3:39 AM
I'm curious if people here are using Jooby. Got nice techempower scores (fwiw) and seems to have good Kotlin support (although I haven't seen a Jooby room in this slack)
m

Matteo Mirk

09/08/2020, 10:29 AM
I was immediately fascinated by Jooby but never tried it out in Java. Interesting that has Kotlin support as well, I’ll look into it. Thanks
👍 1
a

asad.awadia

09/08/2020, 1:44 PM
Jooby gets mentioned everytime SQL/DB/ORMs come up - but whenever I go to the site it looksl ike a paid product with a bad UI
e

Emmanuel Oga

09/08/2020, 1:53 PM
oh I think you are confusing jooby with JOOQ 😛
a

asad.awadia

09/08/2020, 1:54 PM
hahahahaha 😂 too early in the morning
😛 1
yes - I didn’t use jooby because it has annotations - trying to stay away from that stuff - Javalin has been my goto for any blocking style api and vert.x for nonblocking style api
❤️ 3
e

Emmanuel Oga

09/08/2020, 1:56 PM
so jooby is at version 2.x now, it has supports both annotations and a more sinatra like API
☝️ 1
vert.x looks brutal, spring like level of complexity, at least without knowing too much about it
haven't seen javalin before, looks pretty nice, similar to jooby actually
View count: 8