I am upgrading spring boot from 2.6.6 to 2.7.1 and running into r2dbc-mysql error.
With Spring boot 2.6.6, I am using r2dbc-mysql.
runtimeOnly 'dev.miku:r2dbc-mysql'
Getting compilation error after upgrading Spring boot to 2.7.1.
So, commented the above from build.gradle and getting the error below at runtime.
Caused by: java.lang.IllegalStateException: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={database=test, host=app-dev-mysql.sdferf1234.us-east-2.rds.amazonaws.com, driver=mysql, password=REDACTED, protocol=, port=3306, user=test}}'. Available drivers: [ pool ]
at io.r2dbc.spi.ConnectionFactories.get(ConnectionFactories.java:143) ~[r2dbc-spi-0.9.1.RELEASE.jar:?]
at org.springframework.boot.r2dbc.ConnectionFactoryBuilder$OptionsCapableWrapper.buildAndWrap(ConnectionFactoryBuilder.java:191) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.r2dbc.ConnectionFactoryBuilder$PoolingAwareOptionsCapableWrapper.buildAndWrap(ConnectionFactoryBuilder.java:207) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.r2dbc.ConnectionFactoryBuilder.build(ConnectionFactoryBuilder.java:177) ~[spring-boot-2.7.1.jar:2.7.1]
at org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations.createConnectionFactory(ConnectionFactoryConfigurations.java:68) ~[spring-boot-autoconfigure-2.7.1.jar:2.7.1]
at org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations$GenericConfiguration.connectionFactory(ConnectionFactoryConfigurations.java:121) ~[spring-boot-autoconfigure-2.7.1.jar:2.7.1]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[spring-beans-5.3.21.jar:5.3.21]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1160) ~[spring-context-5.3.21.jar:5.3.21]
at org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration.lookupConnectionFactory(AbstractR2dbcConfiguration.java:236) ~[spring-data-r2dbc-1.5.1.jar:1.5.1]
CodePudding user response:
Try with implementation group: 'dev.miku', name: 'r2dbc-mysql', version: '0.8.2.RELEASE'
instead of runtimeOnly 'dev.miku:r2dbc-mysql'
, I had the same issue and it worked for me.