Recently I noticed that our spring-boot services are logging a warning from org.springframework.data.convert.CustomConversions.
The message is this:
Registering converter from class microsoft.sql.DateTimeOffset to class java.time.OffsetDateTime as reading converter although it doesn't convert from a store-supported type! You might want to check your annotation setup at the converter implementation.
The relevant dependencies from the pom.xml are
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.4.1.jre16</version>
</dependency>
I can of course suppress the logging of the warning by setting the log-level to error as suggested by answers to the similar question asked here, e.g like this or like this
The entity POJO's date/datetime fields are java.sql.Timestamp or java.util.Date and the SQL Server tables have columns of type date, datetime2 and datetime.
Mapping from POJO's to SQL is done by org.springframework.data.repository.*/org.springframework.data.jdbc.repository.* classes.
I would like to know how to correctly configure CustomConversions so as to avoid the warning altogether, if possible.