Java 类org.springframework.context.support.DelegatingMessageSource 实例源码

项目:lodsve-framework    文件:Messages.java   
@PostConstruct
public void init() {
    synchronized (LOCK_OBJECT) {
        Object obj = context.getBean(DEFAULT_MESSAGE_SOURCE);

        if (obj instanceof DefaultResourceBundleMessageSource) {
            bundleMessageSource = (DefaultResourceBundleMessageSource) obj;
        } else if (obj instanceof DelegatingMessageSource) {
            DelegatingMessageSource delegatingMessageSource = (DelegatingMessageSource) obj;
            Object obj2 = delegatingMessageSource.getParentMessageSource();
            if (obj2 instanceof DefaultResourceBundleMessageSource) {
                bundleMessageSource = (DefaultResourceBundleMessageSource) obj2;
            } else {
                throw new RuntimeException("can not find any messageSource what is DefaultResourceBundleMessageSource!");
            }
        }
    }
}