Skip to content
Advertisement

Spring R2DBC Repos auto configuration not resolving dependencies

I Have the following repository: https://github.com/vlio20/bfit in which I try to use R2DBC in order to do db operations in an async manner. I followed the following tutorial (but maybe it is outdated https://www.youtube.com/watch?v=DvO4zLVDkMs

Here are the relevant dependancies of my pom:

JavaScript

I am using the default configurations, so I only have the following configuration in my properties yaml:

JavaScript

And this is the error that I am getting:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userController’ defined in file [/Users/vioffe/personal/bfit/api/target/classes/com/bfit/api/user/controller/UserController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userService’ defined in file [/Users/vioffe/personal/bfit/api/target/classes/com/bfit/api/user/service/UserService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userRepo’ defined in com.bfit.api.user.db.UserRepo defined in @EnableR2dbcRepositories declared on R2dbcRepositoriesAutoConfigureRegistrar.EnableR2dbcRepositoriesConfiguration: Cannot resolve reference to bean ‘r2dbcEntityTemplate’ while setting bean property ‘entityOperations’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘r2dbcEntityTemplate’ defined in class path resource [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘r2dbcEntityTemplate’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘r2dbcConverter’ defined in class path resource [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘r2dbcConverter’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘r2dbcMappingContext’ defined in class path resource [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.class]: Unsatisfied dependency expressed through method ‘r2dbcMappingContext’ parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘r2dbcCustomConversions’ defined in class path resource [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.r2dbc.convert.R2dbcCustomConversions]: Factory method ‘r2dbcCustomConversions’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/convert/JodaTimeConverters

Here is the full stack trace: https://pastebin.com/X4DGm4rQ

Advertisement

Answer

As the error message:

JavaScript

mentioned, you miss the spring-data-commons jar. Add it as dependency and the error should be solved.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement