Custom ResourceBundleMessageSource to retrieve properties like Locale
I have a use case where I want to retrieve messages based on sport (I am taking sport just for an example). I have properties file for each sport (two in this example, football and tennis). Below is the property file for football and tennis: messages_football.properties messages_tennis.properties Bean definition: I will refer to the keys in my application from these property files like given below Accessing key in Java code: Let's say my context is footbal, then when I execute messageSource.getMessage(message1, null, locale), output should be "Football message1", similary if my context is tennis I want my output as "Tennis message1". This is similar like the way locale works in MessageSource. Is there any way to achieve this in Spring/Java? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the web...