0

I just implemented the CrudRepository interface and I figured out I cannot use the apply the orElseThrows to throws a custom exception to the default save method's return.

What am I supposed to do in order achieve this support ? Should I overwrite the save method ?

Thank you in advance.

1 Answers1

0

Yes, you should overwrite the save method. Since orElseThrow() is a method of java.util.Optional class your method should return an Optional object.

gal_boti12
  • 34
  • 2