Spring REST by Balaji Varanasi & Maxim Bartkov

Spring REST by Balaji Varanasi & Maxim Bartkov

Author:Balaji Varanasi & Maxim Bartkov
Language: eng
Format: epub
ISBN: 9781484274774
Publisher: Apress


Externalizing Error Messages

We have made quite a bit of progress with our input validation and provided the client with descriptive error messages that can help them troubleshoot and recover from those errors. However, the actual validation error message may not be very descriptive and API developers might want to change it. It would be even better if they were able to pull this message from an external properties file. The property file approach not only simplifies Java code but also makes it easy to swap the messages without making code changes. It also sets the stage for future internationalization/localization needs. To achieve this, create a messages.properties file under the src\main
esources folder, and add the following two messages:NotEmpty.poll.question=Question is a required field

Size.poll.options=Options must be greater than {2} and less than {1}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.