Skip to content

Register runtime hints for Timestamp to Instant conversion #35156

Open
@SanderKnauff

Description

@SanderKnauff

Original Title

Default RowMapper converters are different between JVM and Native builds

Issue Description

When creating a Spring JDBC application with GraalVM native support it seems that the Converters that normally are available by default, are not registered automatically.

If I run my application using ./mvnw spring-boot:run, everything executes fine. When running the application using ./mvnw -Pnative native:compile && ./target/native-jdbc-converters, I get the following error:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.sql.Timestamp] to type [java.time.Instant].

I would expect this to work the same for a basic application. Does the native image build require extra configuration to register the JSR310 converters?

A repository with reproduction code can be found here:
https://github.com/SanderKnauff/reproduction-spring-native-jdbc-converters

Reproduction steps

  1. Clone the repository above.
  2. Start the PostgreSQL database using docker-compose up.
  3. Run the application once with ./mvnw spring-boot:run. This time it should work fine.
  4. Run the native application by running ./mvnw native:compile && ./target/native-jdbc-converters. This will result in the aforementioned exception.

Environment

  • Spring Boot 3.5.4
  • OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)
  • Linux Mint

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: waiting-for-triageAn issue we've not yet triaged or decided ontheme: aotAn issue related to Ahead-of-time processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions