javaspring-bootkotlingraalvmr2dbc

r2dbc throws 'url' attribute is not specified on graalVm native app


Does graalVm have issues with r2dbc working on postgres in Kotlin? I run the sample demo project from spring boot initializers (Kotlin, sping-boot 3.4.3, java 21), which has r2dbc dependency. When I build the project and run it:

./myNativeApp --spring.r2dbc.url=r2dbc:postgresql:db_path --spring.r2dbc.username=user --spring.r2dbc.password=pass

I get an error message:

Failed to configure a ConnectionFactory: 'url' attribute is not specified and no embedded database could be configured.
    
Reason: Failed to determine a suitable R2DBC Connection URL

Why?

I generated native config files using agent. I've tried to run the project without r2dbc to check that other external parameters are passed correctly, and that worked. I've also tried to set exeternal properties as environment variables (e.g. export SPRING_R2DBC_URL=r2dbc:postgresql:db_path), and also I'm sure that everything is fine with the db itself, as I can run the same project on JVM.

P.S. I know about this question, it does not suggest any meaningful solution.


Solution

  • Spring-boot community suggests to tell Spring AOT at build time what features you're going to use: