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

NullableWrapperToVavrOptionConverter fails after vavr upgrade with Method Option.none() must be Methodref constant #2946

Closed
AlbertSnows opened this issue Sep 27, 2023 · 4 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@AlbertSnows
Copy link

AlbertSnows commented Sep 27, 2023

Problem: starter-data-r2dbc library throws exception when booting up a spring boot webflux project that also includes vavr

Java SDK: Eclipse Temurin version 20.0.2

Exception:

2023-09-27T13:54:49.798-0500 [QUIET] [system.out] 2023-09-27T13:54:49.799-05:00  WARN 5271 --- [           main] onfigReactiveWebServerApplicationContex
t : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error cre
ating bean with name 'r2dbcEntityTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.
class]: Failed to instantiate [org.springframework.data.r2dbc.core.R2dbcEntityTemplate]: Factory method 'r2dbcEntityTemplate' threw exception with messa
ge: Method 'io.vavr.control.Option io.vavr.control.Option.none()' must be Methodref constant

Files:
This problem can be recreated with a minimal project build off of the spring initializer, with some minor tweaks for the following files.

build.gradle

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.1.3'
    id 'io.spring.dependency-management' version '1.1.3'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc' // <-- commenting this line "resolves" the issue
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    runtimeOnly('io.r2dbc:r2dbc-h2:1.0.0.RELEASE')
    implementation 'io.vavr:vavr:1.0.0-alpha-4'
}

application.yml

spring:
  r2dbc:
    url: r2dbc:h2:mem:///testdb #create DB in memory
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 27, 2023
@AlbertSnows
Copy link
Author

AlbertSnows commented Sep 27, 2023

Looking it over again, the classpath is org.springframework.boot not org.springframework.data, meaning this might be the wrong repository to put this. In which case feel free to close the issue.
Edit: actually yeah I think this belongs in https://github.com/spring-projects/spring-boot/issues, will close shortly.

@AlbertSnows
Copy link
Author

reopening, refer to the mention above.

@AlbertSnows AlbertSnows reopened this Sep 27, 2023
@mp911de mp911de changed the title starter-data-r2dbc asks for vavr none() to be a Methodref constant NullableWrapperToVavrOptionConverter fails after vavr upgrade with Method Option.none() must be Methodref constant Sep 28, 2023
@mp911de mp911de transferred this issue from spring-projects/spring-data-relational Sep 28, 2023
@mp911de
Copy link
Member

mp911de commented Sep 28, 2023

The referenced version vavr-1.0.0-alpha-4 was released a couple of years ago. Since then, no new release has been shipped. Vavr's future is highly unpredictable and the 1.x development line comes with several binary breaking changes, e.g. Option was migrated from an interface into an abstract class (that is the reason you see the exception).

Judging from Daniel's comment the alpha version was a playground with a high chance of going back to the 0.10.x design.

At the moment, we do not intend to apply any changes as the future is uncertain and we will reconsider our vavr support for evolution once there is a stable path forward for vavr.

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
@mp911de mp911de added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 28, 2023
@AlbertSnows
Copy link
Author

noted, thanks for sharing your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants