It would be better, I think, to address the problem directly rather than trying to suppress the exception, which can lead to behavior and incomplete actions.
However, you did not tell us how you want the system to respond when the message is not defined for a given code. Do you need an empty string, or should the code itself be used as the default message?
, - Spring messageSource bean. messageSource beans useCodeAsDefaultMessage. false, true, , , .
messageSource ( , ) getDefaultMessage() , .