0
java.version=17
spring-boot-starter-data-r2dbc=3.1.1
spring-boot-starter-webflux=3.1.1

I have specified the following in application.properties to be picked up by the auto configuration.

spring.r2dbc.url=r2dbc:pool:mysql://localhost:3306/airportdb
spring.r2dbc.username=admin
spring.r2dbc.password=REDACTED
logging.level.root=DEBUG

When I start the Spring boot application I get the following exception at the bottom of the log.

Caused by: java.lang.IllegalStateException: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={database=airportdb, host=localhost, driver=mysql, password=REDACTED, protocol=, port=3306, user=admin}}'. Available drivers: [ pool ]

Now, I have been able to solve this exception by adding this snippet to my pom.xml in the dependencies section.

<dependency>
    <groupId>io.r2dbc</groupId>
    <artifactId>r2dbc-h2</artifactId>
    <scope>runtime</scope>
</dependency>

EDIT- This is already a part of my effective pom, I'm not adding it new, just changing it's scope which resolves my issue.

As soon as I add this to my pom, I'm able to launch the app and it works flawlessly but for the life of me I can't understand what the original problem was and how just changing the scope of this dependency which has been pulled in by spring-boot-starter-data-r2dbc solves it. Thanks.

Gestalt
  • 93
  • 10
  • Is mysql actually being *used* now? (As opposed to H2) I thought it didn't support r2dbc yet – g00se Jul 20 '23 at 14:40
  • The effective pom has this driver r2dbc-mysql with groupId io.asyncer. My configuration is for my local mysql db as well, although I haven't performed a CRUD operation yet. – Gestalt Jul 20 '23 at 14:45
  • I'm not quite sure whether that was a yes or no. I'm guessing "no" so far... – g00se Jul 20 '23 at 14:49
  • I was just able to run a fetchById query from a ReactiveCrudRepository on mysql's airport sample db's booking table. At least reactive reads are supported in 2023. – Gestalt Jul 20 '23 at 15:26
  • That's good, try a save and check that a write has occurred in the mysql table – g00se Jul 20 '23 at 17:00

0 Answers0