org.springframework.beans.factory.support.RootBeanDefinition#getSource ( )源码实例Demo

下面列出了org.springframework.beans.factory.support.RootBeanDefinition#getSource ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition,
		Class<?> beanType, String beanName) {
	if (checkSentinelProtect(beanDefinition, beanType, beanName)) {
		SentinelRestTemplate sentinelRestTemplate;
		if (beanDefinition.getSource() instanceof StandardMethodMetadata) {
			sentinelRestTemplate = ((StandardMethodMetadata) beanDefinition
					.getSource()).getIntrospectedMethod()
							.getAnnotation(SentinelRestTemplate.class);
		}
		else {
			sentinelRestTemplate = beanDefinition.getResolvedFactoryMethod()
					.getAnnotation(SentinelRestTemplate.class);
		}
		// check class and method validation
		checkSentinelRestTemplate(sentinelRestTemplate, beanName);
		cache.put(beanName, sentinelRestTemplate);
	}
}
 
private boolean checkMethodMetadataReadingVisitor(RootBeanDefinition beanDefinition) {
	return beanDefinition.getSource() instanceof MethodMetadata
			&& ((MethodMetadata) beanDefinition.getSource())
					.isAnnotated(SentinelRestTemplate.class.getName());
}