So, it's better to pass the Locale to EJB via parameter, instead of get it myself from FacesContext;
Now, if I do use this parameter in every method, whats a good approach to set it only once?
I don't like the idea of a setLocale()
method; I would like to force it to be set, with some compilation error (instead of seeing the error only later at runtime).
For this answer, looks like I can't use construtor parameter. The idea of setting the attribute in the request is nice, but the only way I know to get the request object is via FacesContext
, what, again, we don't want the FacesContext dependency inside the EJB.
Is there some way to force the developer to pass the Locale for the EJB? I mean, if not set, generate a compilation error?