Removed possibility to get ClassCastException on Error occurence

We encountered an issue in our production service when an OutOfMemoryError was thrown from a rest controller and caused a ClassCastException in Boot thus masking a real cause of the malfunction. The fix is a sample one-liner that changes a reference type to remove the casting issue.