Skip to content
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

Rename DatabaseClient bean to r2dbcDatabaseClient #296

Closed
mp911de opened this issue Feb 6, 2020 · 5 comments
Closed

Rename DatabaseClient bean to r2dbcDatabaseClient #296

mp911de opened this issue Feb 6, 2020 · 5 comments
Labels
type: task A general task

Comments

@mp911de
Copy link
Member

mp911de commented Feb 6, 2020

databaseClient is a generic name that asks for clashing with other beans with similar names. We should rename it long-term to r2dbcDatabaseClient. For now, we should change references in @EnableR2dbcRepositories and add a bean name alias to our configuration.

@mp911de mp911de added the type: task A general task label Feb 6, 2020
@mp911de mp911de added this to the 1.1 M3 (Neumann) milestone Feb 6, 2020
@mp911de mp911de closed this as completed Feb 12, 2020
@62mkv
Copy link

62mkv commented Mar 17, 2020

hi! as of 1.1.0.M4, this clashes with R2dbcDataAutoConfiguration as of spring-boot-autoconfigure-r2dbc-0.1.0.M3 which seems to be the latest available version for Spring Boot users.

Would you suggest any workaround (apart from just duplicating all auto-configured beans manually in end users code?)

@62mkv
Copy link

62mkv commented Mar 17, 2020

apparently, there's bigger problem as well:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.data.r2dbc.mapping.R2dbcMappingContext.<init>(R2dbcMappingContext.java:45)

The following method did not exist:

    org.springframework.data.r2dbc.mapping.R2dbcMappingContext.setForceQuote(Z)V

The method's class, org.springframework.data.r2dbc.mapping.R2dbcMappingContext, is available from the following locations:

    jar:file:/C:/Users/username/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-r2dbc/1.1.0.M4/e99980706af72dad3bdf44b05eb2256a47c30dae/spring-data-r2dbc-1.1.0.M4.jar!/org/springframework/data/r2dbc/mapping/R2dbcMappingContext.class

It was loaded from the following location:

    file:/C:/Users/username/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-r2dbc/1.1.0.M4/e99980706af72dad3bdf44b05eb2256a47c30dae/spring-data-r2dbc-1.1.0.M4.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.r2dbc.mapping.R2dbcMappingContext

this occurs with a following Gradle config:

dependencyManagement {
    imports {
        mavenBom 'org.springframework.boot.experimental:spring-boot-bom-r2dbc:0.1.0.M3'
    }
}
    // this is for SpEL support in @Query annotations
    implementation 'org.springframework.data:spring-data-r2dbc:1.1.0.M4'
    //======= after this line go dependencies added by Spring Initializr
    implementation 'org.springframework.boot.experimental:spring-boot-starter-data-r2dbc'
...

and following annotation on PersistenceConfiguration class:
@EnableR2dbcRepositories(basePackages = "com.example.repository", databaseClientRef = "databaseClient")

@62mkv
Copy link

62mkv commented Mar 17, 2020

this problem is actually due to conflicts with the spring-data-relational package: BOM applies 1.1.4-RELEASE version, while 1.1.0.M4 of this project depends on 2.0.0 snapshot.

@mp911de
Copy link
Member Author

mp911de commented Mar 17, 2020

The experimental R2DBC autoconfiguration went into Spring Boot proper. You can consume either the snapshot versions or switch to the milestones as of end of this month with Spring Boot 2.3 M4.

@javaverse
Copy link

The experimental R2DBC autoconfiguration went into Spring Boot proper. You can consume either the snapshot versions or switch to the milestones as of end of this month with Spring Boot 2.3 M4.

It still doesn't work on 2.3.0M4.

required a bean named 'r2dbcDatabaseClient' that could not be found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

3 participants