I have a controller that shows a form and loads messages from a properties file. I extended ReloadableResourceBundleMessageSource and called it DatabaseMessageSource. Now if there is a message in the database it will get that and if not default to what is in the proeprties file. Link to example
My database lookup is called like getCode(companyId, code). To make the above example work I just passed a 1 for companyId.
I would like to pass the companyId that is in session to the DatabaseMessageSource so it can pull the right messages for that particular company. Does anyone know how I can accomplish this?
You can obtain the current
HttpSessionat any point using this:Then get your attribute from there.