ClassCastException
in JpaRepository
method that returns Stream<>
when running in native image
#30176
Labels
for: external-project
Needs a fix in external project
status: duplicate
A duplicate of another issue
Uh oh!
There was an error while loading. Please reload this page.
I have a JPA repository with the following method:
The method is used in a REST controller as follows:
In works well when my application is running as a regular Java app under JRE. But when I build it into a Docker image using Spring Native, the invocation of
findFirst()
in the code above causesClassCastException
:The workaround is to change the repository method's return value from
Stream<>
toList<>
.Please refer to spring-native-issues repo with a complete demo. Make sure
stream-first
branch of the repo is used.The text was updated successfully, but these errors were encountered: