When having a repository return a Kotlin data class, it won't be able to convert the entity to the data class dto. The functionality that I want to use is described here in the spring data JPA documentation.
Instead, a ConverterNotFoundException is raised:
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [com.example.demo.model.Person] to type [com.example.demo.dto.PersonDto]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:294) ~[spring-core-6.1.8.jar:6.1.8]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:185) ~[spring-core-6.1.8.jar:6.1.8]
at org.springframework.core.convert.support.CollectionToCollectionConverter.convert(CollectionToCollectionConverter.java:89) ~[spring-core-6.1.8.jar:6.1.8]
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41) ~[spring-core-6.1.8.jar:6.1.8]
I've created a minimal reproducible example here: https://github.com/stefanw25/spring-data-dto-projection-minimal
Spring Boot version: 3.3.0
Comment From: wilkinsona
Spring Data JPA is managed as a separate project. Please open an issue over there so they the Spring Data team can investigate.