New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring boot starter r2dbc - configuration bug #21586
Comments
@ndopj Are you able to share a sample project to save us a bit of time building one from the snippets you provided? |
https://github.com/ndopj/spring-boot-2.3.0-r2dbc-bug/tree/manual-configuration-bug Master branch contains configuration for the first specified case. The second case is really probably conflict between (as was proposed within issue linked in the description) spring-boot-data-jpa and spring-boot-data-r2dbc dependencies, since i am using both of them in my project. However i am still not able to reproduce second case bug in regular project so i will investigate further on my own. That means following conflict reason might be causing second case bug (since i am getting exactly same error), if spring-boot-starter-data-jdbc and spring-boot-starter-data-r2dbc are using different version of spring-data-relational: For the first bug, possible solution might be creation of bean r2dbcDatabaseClient manually, but i would expect spring boot auto-configuration to configure that bean same as EntityManager bean is configured in case of spring-boot-starter-data-jpa, with use of properties inside application.properties file, so one can use "CrudRepositories" without any additional configuration. Both bugs i mentioned are already mentioned in the link i posted in the description of this issue: |
@ndopj thanks for the sample but this project works fine for me (if we ignore the r2dbc url that I've changed to use an in-memory database. Just to confirm, I am using the branch). The error you've described above could happen if you use the experimental r2dbc support that has moved to Spring Boot 2.3 or if your dependency management is broken. None of that is the case in the sample that you've shared and it works properly for me. To go further with this, we need a sample that reproduces the error above. |
With clearing gradle cache, project cache, gradle dependencies and reevaluating the project i can confirm that auto-configuration in the first case is working properly as expected. I need to investigate second case on my own since as @snicoll proposed, problems might have different origin as i tough and i am not able to reproduce. I am using only spring boot 2.3.0 starter dependencies. Thank you all for cooperation and sorry for time taken by this issue, since it doesn't seem to be bug at all. |
Thanks for letting us know. |
After hours of debugging dependencies in gradle i've finally found out that second case error might occur when using spring-boot-starter-data-r2dbc together with spring-cloud-sleuth dependency management. I am using latest version of spring-cloud-sleuth (2.2.2.RELEASE: Mar, 2020). Note that gradle automatically downgrades most of spring boot starter dependencies to 2.2.5 versions with this dependency management setup.
|
@ndopj I'm having trouble replicating that behavior, can you please share a sample project that shows the downgrades happening? |
This looks like a mistake in the Spring Cloud Sleuth documentation to me. It recommends using |
It is indeed and the reference guide actually describes the correct setup. I've created spring-cloud/spring-cloud-sleuth#1658 so that this page refers to the correct bom. @ndopj you can also create an app on start.spring.io with the dependencies that your project needs if you want an example of a working setup. |
Current release 2.3.0 contains a bug when using auto-configuration and manual configuration of r2dbc drivers to use reactive repositories, making reactive repositories functionality unusable at all.
Gradle Dependencies:
application.properties
Spring Boot main application:
Error:
When trying to do configuration manually different error occures (same dependencies but without application.properties r2dbc properties):
Configuration
Error:
This is probably somehow linked to:
spring-projects/spring-data-r2dbc#296 (comment)
Mentioned conflict reason is usage of wrong dependencies, but since i am only using spring boot starter dependencies this is not my case.
The text was updated successfully, but these errors were encountered: