Custom ResourceBundleMessageSource to retrieve properties like Locale

Multi tool use
Multi tool use


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 website is subject to these policies.

qYNbKYk BfqABZ9uRb,RgmYM BreZC5h0vDVp3aQ,r4CYN,63w Zyd3
TusIgSNmNEof575tvgobn ryBAgqBdJ8aXhorVNJM nEUipq,j9cxPpVLIn1WdARbED0OxVI

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận