Description
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
- Clone the repository above.
- Start the PostgreSQL database using
docker-compose up
. - Run the application once with
./mvnw spring-boot:run
. This time it should work fine. - 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