Question

With SpringMVC, 'Object' name is displaying instead of parameter value. Below is my code.

msg("label.key.is.inactive", "Parameter");

label.key.is.inactive = key ''{0}'' is inactive. -- Present in properties file

@Autowired
private MessageSource messageSource;

protected String msg(final String msgKey,final Object... params){
  return messageSource.getMessage(msgKey, new Object[]{params}, Locale.US);
}

Output: Expected: key 'Parameter' is inactive. Actual: key '[Ljava.lang.Object;@394a861' is inactive.

Can someone tell me what should be done to get the expected output.

Was it helpful?

Solution

Try this:

return messageSource.getMessage(msgKey, params, Locale.US);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top