In Spring boot 2.4.1 & 2.4.0 When use projection with field LocalDateTime

public interface Report {
    UUID getId();
    LocalDateTime getCreateDate();
}

after fetch it from DB, get exception when try access to LocalDateTime field getCreateDate()

Caused by: java.lang.IllegalArgumentException: Projection type must be an interface!
    at org.springframework.util.Assert.isTrue(Assert.java:121)
    at org.springframework.data.projection.ProxyProjectionFactory.createProjection(ProxyProjectionFactory.java:105)
    at org.springframework.data.projection.SpelAwareProxyProjectionFactory.createProjection(SpelAwareProxyProjectionFactory.java:45)
    at org.springframework.data.projection.ProjectingMethodInterceptor.getProjection(ProjectingMethodInterceptor.java:160)
    at org.springframework.data.projection.ProjectingMethodInterceptor.potentiallyConvertResult(ProjectingMethodInterceptor.java:108)
    at org.springframework.data.projection.ProjectingMethodInterceptor.invoke(ProjectingMethodInterceptor.java:85)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

And in previews versions it works ok

Comment From: wilkinsona

Spring Data has required projection types to be an interface since projection support was introduced so it's not clear why it's started to fail upon upgrade to Spring Boot 2.4 and, therefore, Spring Data 2020.0. I suspect it'll be due to a change somewhere in Spring Data but I can't tell for certain from what you've shared thus far. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: Aiksandr

Hello @wilkinsona , i made sample project, if You run it like usual Spring app, that will throw this exception https://github.com/Aiksandr/spring-jpa-demo

Comment From: wilkinsona

Thanks for the sample. I've reproduced the problem.

With Spring Data Neumann (used by Spring Boot 2.3), the projection isn't used and the java.sql.Timestamp from the DB is converted to a LocalDateTime by the conversion service's object to object converter. With Spring Data 2020.0 (used by Spring Boot 2.4), the object to object converter is removed from the conversion service. This leaves it unable to perform the Timestamp to LocalDateTime conversion so an attempt to use the projection is made instead.

I'm not sure if what you're experiencing is intentional or an unintended side-effect. Please open a Spring Data Commons issue so that the Data team can take a look and also comment here with a link to the issue so that we can follow along.

Comment From: Aiksandr

Ok, Created issue in Data Commons https://jira.spring.io/browse/DATACMNS-1847