@SuppressWarnings("serial") @Override public MessageCodesResolver getMessageCodesResolver() { return new DefaultMessageCodesResolver() { @Override public String[] resolveMessageCodes(String errorCode, String objectName) { return new String[] { "custom." + errorCode }; } }; }
@Test public void getCustomMessageCodesResolver() { given(webMvcConfigurer.getMessageCodesResolver()).willReturn(new DefaultMessageCodesResolver()); delegatingConfig.setConfigurers(Arrays.asList(webMvcConfigurer)); delegatingConfig.getMessageCodesResolver(); verify(webMvcConfigurer).getMessageCodesResolver(); }
@Override public MessageCodesResolver getMessageCodesResolver() { if (this.mvcProperties.getMessageCodesResolverFormat() != null) { DefaultMessageCodesResolver resolver = new DefaultMessageCodesResolver(); resolver.setMessageCodeFormatter( this.mvcProperties.getMessageCodesResolverFormat()); return resolver; } return null; }
public DefaultMessageCodesResolver.Format getMessageCodesResolverFormat() { return this.messageCodesResolverFormat; }
public void setMessageCodesResolverFormat( DefaultMessageCodesResolver.Format messageCodesResolverFormat) { this.messageCodesResolverFormat = messageCodesResolverFormat; }