Spring Boot Internationalization with Default Locale for Message Strings
How to add Spring Boot Internationalization with Default Locale for Storing Message Strings such as Validation Messages in a message.properties file This article will show you how to use a properties file to define static text in your application such as for validation message. All the code is appended at the bottom of the article. You can also view all the code here: Link to Github Gist here Add Default locale and Message Source beans to your Application class Add these classes to set your default locale and configure the location of your message properties file Add locale and MessageSource beans to your Application Class Add a Service and Interface to retrieve message text This service will pull the default locale from the session and then get the message text from your properties file using the messageSource. Add a service to get the msgs in your props file In your controller, use the Message s...