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

Upgrading to Spring Boot 2.4.2 results in ConverterNotFoundException for String to Duration #25878

Closed
dmkeen opened this issue Apr 3, 2021 · 1 comment
Labels
for: external-project For an external project and not something we can fix

Comments

@dmkeen
Copy link

dmkeen commented Apr 3, 2021

I've encountered an issue when upgrading from Spring Boot 2.4.1 to 2.4.2. I can't determine if it is an actual issue with Spring Boot or a dependency.

I have a Spring Data repository that returns an object with a Duration field which is stored in the database as a String. In Spring Boot 2.4.1 the object is created and returned successfully. After upgrading to Spring Boot 2.4.2, the following exception is thrown:

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.time.Duration]

I've created a project that demonstrates the issue here: https://github.com/dmkeen/spring-boot-2.4.2-issue

@scottfrederick
Copy link
Contributor

Thanks very much for the sample. I can reproduce the problem you're seeing.

The conversion error is coming from Spring Data JDBC. Spring Boot 2.4.2 uses Spring Data BOM 2020.0.3, while Spring Boot 2.4.1 uses Spring Data 2020.0.2. Using Boot 2.4.2 while downgrading the Data version back to 2020.0.2 will reproduce the problem. You can see this by making the following change to pom.xml in the sample:

  <properties>
    ...
    <spring-data-bom.version>2020.0.2</spring-data-bom.version>
  </properties>

With Spring Data 2020.0.2, Spring Data JDBC is getting the expected String value of PT40M and successfully converting it to a java.time.Duration. With Spring Data 2020.0.3, Spring Data JDBC is getting INTERVAL '2400' SECOND instead, which appears to be the String representation of an org.h2.api.Interval. I can't identify a change in Spring Data JDBC that would cause this difference.

Please file an issue in Spring Data JDBC so that team can look into the issue. You can comment on this issue with a link to the Data issue for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

3 participants