https://kotlinlang.org logo
Join SlackCommunities
Powered by
# micronaut
  • s

    Swanand Keskar

    03/01/2021, 2:47 PM
    Hi , how to use property loader with
    MicronautLambdaContainerHandler
    ?
    • 1
    • 1
  • c

    Cameron Stuart

    06/11/2021, 4:58 PM
    Hello everyone. I'm brand new to micronaut (and kotlin too really) and I am wondering if anyone can point to a working example of mqtt being used (subscriber) in a micronaut app. The docs here https://micronaut-projects.github.io/micronaut-mqtt/latest/guide/ require a level of prior knowledge with micronaut that I sadly don't have. A working example would be very helpful!
  • c

    Cameron Stuart

    06/16/2021, 2:10 AM
    Hey does anyone else find that tests with
    @MicronautTest
    in intellij don't have the execution arrow in the gutter to run individual tests?
  • c

    Cameron Stuart

    06/16/2021, 2:11 AM
    I only seem to be able to run my full test suite with my gradle run configuration
  • c

    Cameron Stuart

    07/05/2021, 7:48 AM
    Can anyone point me toward docs / examples for Kotlin JDBI in micronut? I can't seem to get started with (by possibly injecting?) the JDBI
    handle
    from my hikari/jdbc connected database
    d
    • 2
    • 1
  • d

    dpux

    10/21/2021, 5:50 PM
    withContext
    is throwing null pointer exception in my code. This seems like a new issue, never faced this before. Using Micronaut 3.1.0, Kotlin 1.5.31, kotlin-runtime 3.1.0
    j
    • 2
    • 8
  • g

    gbaldeck

    03/15/2022, 3:51 PM
    hi all, I'm trying to setup a gradle multiproject build with micronaut 3.3.0 and kotlin 1.6.10 but I am getting the below error when I try to build and run my tests. Has anyone else experienced this?
    The following options were not recognized by any processor: '[micronaut.processing.group,, kapt.kotlin.generated]'
    j
    • 2
    • 1
  • c

    Christian Oleson

    04/03/2022, 3:38 AM
    Anybody have a recommended ORM for use with Kotlin /Micronaut?
    d
    k
    +2
    • 5
    • 7
  • j

    Júlio Santos

    05/11/2022, 1:25 AM
    Guys, does anyone have an example with gRPC?
    j
    • 2
    • 1
  • c

    César

    06/23/2022, 2:48 PM
    hey guys! we're considering to use Micronaut+Kotlin for our backend services. For people that has used Micronaut+Kotlin in production, how were your experiences? would you choose it again if you started from scratch?
    j
    s
    • 3
    • 13
  • j

    Júlio Santos

    07/18/2022, 9:34 PM
    Guys, have you ever experimented with graalvm? If so, could you please share
    c
    • 2
    • 1
  • s

    Sam Gammon

    11/09/2022, 7:59 PM
    hello cool micronaut kotlin people 🙂
  • s

    Sam Gammon

    11/10/2022, 4:02 AM
    i am working on a new web-focused micronaut meta-framework / series of modules
    c
    • 2
    • 8
  • s

    Sam Gammon

    11/10/2022, 4:02 AM
    would love to collaborate with people who are interested or have ideas
  • s

    Sam Gammon

    01/01/2023, 2:54 AM
    Hello K friends, What if Node were more than just JS? To celebrate the new year, I am pleased to share a new project called Elide, a new server runtime, like Node or Deno, but polyglot, written in Kotlin and based on GraalVM. We are in alpha and very open to early feedback and contributions for anyone interested, over in #framework-elide 🥳 You can do wild things with it, like fast React SSR in Micronaut or Spring. Guest language support is starting with JS, but there are plans to integrate other languages like Python, Ruby, and Rust/Go/etc. via LLVM. Of course,
    native-image
    is supported out of the box. • 🚀 Trying it out
    Copy code
    curl -sSL --tlsv1.2 dl.elide.dev/cli/install.sh | bash -s -
    👆 the one liner works on Darwin (amd64/arm64), and Linux (amd64) so far.
    If you prefer NPX:
    Copy code
    npx @elide-dev/elide@alpha shell
    K Building Kotlin apps with it • Elide can be used as a plain library with a regular Micronaut server, and Ktor support is on the way. There are Maven artifacts in a custom repository which is easy to use during the alpha; you can see a sample here. • G Gradle plugin You can easily install the Gradle plugin to build your frontend assets and your Kotlin/JS, and package it into your server binary. It will handle building for SSR and CSR both, so you can easily switch between browser rendering modes. Check it out here. Maven and Bazel support are planned. • 🖥️ Using the shell
    elide shell
    drops you into a shell just like Node (see attached screenshot), the difference being the
    URL
    class we're using here is implemented in Kotlin, backed by the road-tested power of Micronaut, KotlinX, Netty, and the Java standard library. It has simply been adapted for use in JavaScript, according to the WhatWG URL Spec. • js Use Kotlin/JS or regular Node stack Elide packages and consumes your JS/TS with built-in support for
    esbuild
    , so you can use a standard Node toolchain or the Kotlin/JS stack. • 💨 Super fast React SSR Because Elide is basically Kotlin with a super-fast JS runtime attached, it can do JS SSR without leaving the JVM. This can soon be drop-in compatible with many React apps. You can see a live sample here to confirm it is fast and server-rendered. The code for that sample is pasted below to show how simple it is to call back and forth between Kotlin and your React app:
    Copy code
    @Page class Index : PageWithProps<YourProps>(YourProps.serializer()) {
    
        // Serve React SSR.
        @Get("/") suspend fun indexPage(request: HttpRequest<*>) = ssr(request) {    // 1: tell the server we're going to do SSR for this request
          head {
            title { +"Hello, Elide!" }
            stylesheet("/styles/base.css")
            stylesheet("/styles/main.css")
            script("/scripts/ui.js", defer = true)   // <-- 2: serve the CSR bundle so it can hydrate the react SSR response
          }
          body {
            injectSSR(this@Index, request)    // <-- 3: execute the JS VM to produce the SSR response, and splice it into the server response
          }
        }
    
    }
    • 🐙 Contributors needed The future of software is much more polyglot than today's paradigm: developers love to fight about frameworks, but at the end of the day, we're all writing code, and eliminating barriers between languages means easier collaboration and more value for all of us. It shouldn't be a Node vs. The World or a Rust vs. The World argument; we should get to pick and pull the best code we want from anywhere and use it to build our apps, especially from a multi-platform language like Kotlin. This runtime and framework are designed for that future. *If you agree, join us and make a dent in the universe*; you'll have a chance to be impactful and shape a brave new idea from the ground up. • 🙏 Thank you We chose Kotlin because of the fantastic community. 2023 will be a massive year for Kotlin, and we think that betting the farm on it is reasonable and smart. We are super excited about what JetBrains and Kotlin have in store for us with K2, context receivers, value classes... just so much to look forward to. Cheers and happy new year, Kotlin devs, K sam Slack Conversation
  • u

    Ubed

    01/04/2023, 1:09 PM
    Has anyone worked on login using google in any kotlin project using micronaut framework? I want to implement this functionality in my project. Also want to generate JWT tokens on successful login. Please help me if you have knowledge about it.
  • j

    Johannes Gätjen

    01/13/2023, 1:52 PM
    Hi, when I update my micronaut version from 3.7.4 to 3.8.0 or 3.8.1 my OpenAPI swagger-ui breaks. Haven't looked deeply into the root cause yet, but I get 404s on these endpoints
    Copy code
    /swagger-ui/res/flattop.css 0002ms
    /swagger-ui/res/swagger-ui-bundle.js 0002ms
    /swagger-ui/res/swagger-ui.css 0001ms
    /swagger-ui/res/swagger-ui-standalone-preset.js 0002ms
    Anyone here who has experienced this and knows if this is intended or if there is a quick workaround (besides downgrading)?
    • 1
    • 1
  • k

    kqr

    01/16/2023, 9:14 AM
    set the channel topic: Discussion about Micronaut and Kotlin (http://micronaut.io). Please vote for https://youtrack.jetbrains.com/issue/KT-15040 For not kotlin related questions, please use https://gitter.im/micronautfw/questions
  • j

    james

    05/30/2023, 11:25 PM
    👋 is any one able to please give me some guidance on an auth flow? last night I was following this guide to get a “Sign in with Google” flow up and running: https://guides.micronaut.io/latest/micronaut-oauth2-oidc-google-gradle-kotlin.html where I get stuck is: my micronaut app does not use
    @View
    functionality, but it does serve a static website, so when Google’s login flow redirects the user to
    <http://localhost:3000/oauth/callback/google>
    with a successful login, I am not sure how to proceed ideally I would like to: • catch that callback, validate the id token with Google ✅ • generate a user session token ✅ • store the user session token in a cookie ❓ • bounce the user to a specific statically served page ❓ the checks are the parts I know how to do, the question marks are the parts I am unsure about. any tips would be greatly appreciated 🙏
  • k

    Khurram Malik

    06/08/2023, 9:48 AM
    Hi everybody, i have a micronaut application with kotlin and gradle kotlin dsl. I want to pass env variables, such as DB_PASS=“XXX” DB_NAME=“XXX”, such that i can access them in main function. What is the best way to do it? My initial thought was to use gradle properties (-P) but i can’t seem to get them working. Any expert who knows what to do here?
    Copy code
    plugins {
        id("org.jetbrains.kotlin.jvm") version "1.8.20"
        id("org.jetbrains.kotlin.plugin.allopen") version "1.8.20"
        id("com.google.devtools.ksp") version "1.8.20-1.0.10"
        id("com.github.johnrengelman.shadow") version "8.1.1"
        id("io.micronaut.application") version "4.0.0-M2"
    }
    
    version = project.properties["version"] as String? ?: "0.0.1"
    group = "dk.****"
    
    val kotlinVersion = project.properties["kotlinVersion"]
    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation("io.micronaut:micronaut-jackson-databind")
        implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
        implementation("io.micronaut:micronaut-management")
        implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
        runtimeOnly("ch.qos.logback:logback-classic")
        runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
        testImplementation("io.micronaut:micronaut-http-client")
    }
    
    application {
        mainClass.set("dk.***.ApplicationKt")
    }
    java {
        sourceCompatibility = JavaVersion.toVersion("17")
    }
    
    tasks {
        compileKotlin {
            compilerOptions {
                jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
            }
        }
        compileTestKotlin {
            compilerOptions {
                jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
            }
        }
    }
    graalvmNative.toolchainDetection.set(false)
    micronaut {
        runtime("netty")
        testRuntime("kotest5")
        processing {
            incremental(true)
            annotations("dk.***.*")
        }
    }
    r
    • 2
    • 1
  • p

    Phil Richardson

    07/16/2023, 1:17 PM
    I have an issue over which certificate/key is being used by my server application. It correctly offers HTTPS to clients that connect, but it is not using the correct one from the keystore. I am using a PKCS12 keystore that contains multiple private key pair entries. I have supplied a valid
    micronaut.ssl.key.alias
    value, but it is deciding to use a different entry to the requested one. I do note that listing entries with keytool, it is the first entry from the output being used, though I don't strictly see this as weight on what is going on. I know this is not strictly Kotlin related, but does anybody have any clues as to what is going on, or better, tips to diagnose the cause?
  • b

    bob

    11/30/2023, 10:45 AM
    Hi, I'm looking into start using coroutines in micronaut, hopefully by just adding
    suspend
    on the controllers and let micronaut handle most of the wiring. But my team has made me aware of a potential issue that using coroutines and
    @Transactional
    doesn't work straight out of the box. And I can't find a resolute documentation on any limitations or caveats on it. Does anyone have a good answer/documentation on the subject?
    l
    • 2
    • 4
  • b

    bob

    12/15/2023, 4:17 PM
    Do I still need to use
    Context propagation
    when using Coroutines?
    • 1
    • 1
  • s

    Slackbot

    01/03/2024, 4:15 PM
    This message was deleted.
    t
    • 2
    • 1
  • u

    Ubed

    01/31/2024, 2:01 PM
    Hi, I'm using
    Publisher<CompletedFileUpload>
    to receive multiple file uploads but it returns more files than expected. is there any work around or any suggestions. I'm working in Micronaut kotlin.
  • a

    Artyom Gornostayev

    03/28/2024, 11:26 AM
    Hello guys. Did anybody have a problem with
    @GeneratedValue
    ? I'm using Micronaut Data with R2DBC. I have a class:
    Copy code
    data class Product(
        @Id
        @GeneratedValue
        var id: Long? = null,
        val publicId: UUID,
        val code: String,
        ...
    )
    When I'm trying to save a new record (
    id = null
    ) with
    repository.save(product)
    the exception has thrown...
    Copy code
    null value in column "id" of relation "products" violates not-null constraint
    I'm not sure what is wrong...
    b
    • 2
    • 2
  • b

    bob

    06/04/2024, 7:20 AM
    I'm curious to the transactions and R2DBC. The documentation says it's hard, that it's taken care of in certain cases, and that I should explicitly set some annotations. It's not a very clear documentation and I feel a bit insecure about the facts vs opinions of the implementation? https://micronaut-projects.github.io/micronaut-r2dbc/1.0.x/guide/#transactionManagement Can anyone guide me? I'm using Coroutines and
    CoroutineCrudRepository
    and not pure Project Reactor. Also the `@R2dbcRepository(dialect = Dialect.POSTGRES)`on my repos.
    a
    • 2
    • 2
  • c

    Christian Oleson

    10/07/2024, 3:27 AM
    I have come from the .NET land and I have been playing with Micronaut. Ive set up a AWS Cognito client and I have Micronaut validating the ID and Access tokens against the JWKS before the requests are processed. I do encode data such as user info in the ID token or group info in the access token, which I go through validation and parsing of the token. I have an object i have created from the payload. In .NET, i could use a Pre Request attribute on a controller method to allow or disallow access to that resource, such as encoded permissions. Likewise, i can use an “OnBeforeRequest” filter to get this data and handle the parsing into my object for injection into my controllers or business logic layer. I seem to be floundering a bit getting this working in Micronaut. Can anyone point me ij the right direction? I admittedly also understand less about the DI than i would like as well.
    • 1
    • 1
  • r

    Robert Jaros

    11/05/2024, 6:35 PM
    Perhaps there is someone here who can answer this questions. Does Micronaut support KSP2? When I'm trying to use my project with
    useKSP2=true
    I'm getting errors like this:
    Copy code
    e: [ksp] Error processing type visitor [io.micronaut.context.visitor.ExecutableVisitor@49e3e5e7]: null
    e: [ksp] java.lang.NullPointerException
    If it's not, does it mean I will not be able to use Micronaut with Kotlin 2.1.0 at all (Kotlin 2.1 will not support KSP1 any more)?
    😮 1
    d
    • 2
    • 5
  • u

    Ubed

    03/18/2025, 12:15 AM
    Is there any smooth way to upgrade to
    Micronaut 4.7.6
    ? And upgrade its compatible dependencies?
    t
    • 2
    • 1