I am using the findByAllIds method of crud repository in spring boot. I would like to pass the list of id's with a comma seperating them in my @pathvariable, the id's are of type uuid so whenever i do that, i get "Failed to convert value of type 'java.lang.String' to required type 'java.util.UUID'; nested exception is java.lang.IllegalArgumentException: Invalid UUID string" error.
Asked
Active
Viewed 1,129 times
-1
-
1You should show us some of your code so we can actually help you. Read the guidelines at https://stackoverflow.com/help/how-to-ask – Sebastiaan van den Broek Jun 21 '19 at 12:56
-
Please add the code in your comment to your question (you can edit it) – Sebastiaan van den Broek Jun 21 '19 at 13:11
1 Answers
1
From the code in your comment I cannot see anything indicated as a @Pathvariable, but even if it is, you mentioned that you are passing multiple UUIDs separated by a comma. However, you only list a single UUID parameter in your method call. If you would attempt to pass multiple UUID strings into that, I would indeed expect the error you're getting, that is java.lang.IllegalArgumentException: Invalid UUID string
Have you tried making the @Pathvariable an array? i.e. UUID[] ids
? Or as a list, i.e. List<UUID> ids
? Both are possible according to Passing an Array or List to @Pathvariable - Spring/Java

Sebastiaan van den Broek
- 5,818
- 7
- 40
- 73