this.messageSource = messageSource;
}
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
if (bean instanceof LabelConfigurable) {
LabelConfigurable configurable = (LabelConfigurable) bean;
try {
String label = messageSource.getMessage(new DefaultMessageSourceResolvable(name + "." + LABEL_KEY),
Locale.getDefault());
if (StringUtils.hasText(label)) {
configurable.setLabelInfo(LabelInfo.valueOf(label));
}
}
catch (NoSuchMessageException e) {
throw new BeanInitializationException("Unable to initialize bean " + name, e);
}