org.springframework.beans.factory.support.AbstractBeanDefinition#setDescription ( )源码实例Demo

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

源代码1 项目: lams   文件: AnnotationConfigUtils.java
static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, AnnotatedTypeMetadata metadata) {
	if (metadata.isAnnotated(Lazy.class.getName())) {
		abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value"));
	}
	else if (abd.getMetadata() != metadata && abd.getMetadata().isAnnotated(Lazy.class.getName())) {
		abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value"));
	}

	if (metadata.isAnnotated(Primary.class.getName())) {
		abd.setPrimary(true);
	}
	if (metadata.isAnnotated(DependsOn.class.getName())) {
		abd.setDependsOn(attributesFor(metadata, DependsOn.class).getStringArray("value"));
	}

	if (abd instanceof AbstractBeanDefinition) {
		AbstractBeanDefinition absBd = (AbstractBeanDefinition) abd;
		if (metadata.isAnnotated(Role.class.getName())) {
			absBd.setRole(attributesFor(metadata, Role.class).getNumber("value").intValue());
		}
		if (metadata.isAnnotated(Description.class.getName())) {
			absBd.setDescription(attributesFor(metadata, Description.class).getString("value"));
		}
	}
}
 
static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd, AnnotatedTypeMetadata metadata) {
	if (metadata.isAnnotated(Lazy.class.getName())) {
		abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value"));
	}
	else if (abd.getMetadata() != metadata && abd.getMetadata().isAnnotated(Lazy.class.getName())) {
		abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value"));
	}

	if (metadata.isAnnotated(Primary.class.getName())) {
		abd.setPrimary(true);
	}
	if (metadata.isAnnotated(DependsOn.class.getName())) {
		abd.setDependsOn(attributesFor(metadata, DependsOn.class).getStringArray("value"));
	}

	if (abd instanceof AbstractBeanDefinition) {
		AbstractBeanDefinition absBd = (AbstractBeanDefinition) abd;
		if (metadata.isAnnotated(Role.class.getName())) {
			absBd.setRole(attributesFor(metadata, Role.class).getNumber("value").intValue());
		}
		if (metadata.isAnnotated(Description.class.getName())) {
			absBd.setDescription(attributesFor(metadata, Description.class).getString("value"));
		}
	}
}
 
源代码3 项目: jdal   文件: CustomBeanDefinitionParser.java
/**
 * Parse bean like a real bean definition.
 * @param ele element
 * @param parserContext parserContext
 * @param builder builder
 */
protected void parseBeanDefinition(Element ele, ParserContext parserContext, BeanDefinitionBuilder builder) {	
	BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
	AbstractBeanDefinition bd = builder.getRawBeanDefinition();
	XmlReaderContext reader =  parserContext.getReaderContext();
	
	try {
		delegate.parseBeanDefinitionAttributes(ele, beanName, null , bd);
		bd.setDescription(DomUtils.getChildElementValueByTagName(ele, "description"));

		delegate.parseMetaElements(ele, bd);
		delegate.parseLookupOverrideSubElements(ele, bd.getMethodOverrides());
		delegate.parseReplacedMethodSubElements(ele, bd.getMethodOverrides());

		delegate.parseConstructorArgElements(ele, bd);
		delegate.parsePropertyElements(ele, bd);
		delegate.parseQualifierElements(ele, bd);

	}
	catch (NoClassDefFoundError err) {
		reader.error("Class that bean class [" + this.beanClass + "] depends on not found", ele, err);
	}
	catch (Throwable ex) {
		reader.error("Unexpected failure during bean definition parsing", ele, ex);
	}
	
}
 
源代码4 项目: spring-analysis-note   文件: Spr7167Tests.java
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	AbstractBeanDefinition bd = (AbstractBeanDefinition) beanFactory.getBeanDefinition("someDependency");
	bd.setDescription("post processed by MyPostProcessor");
}
 
源代码5 项目: java-technology-stack   文件: Spr7167Tests.java
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	AbstractBeanDefinition bd = (AbstractBeanDefinition) beanFactory.getBeanDefinition("someDependency");
	bd.setDescription("post processed by MyPostProcessor");
}
 
源代码6 项目: spring4-understanding   文件: Spr7167Tests.java
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	AbstractBeanDefinition bd = (AbstractBeanDefinition) beanFactory.getBeanDefinition("someDependency");
	bd.setDescription("post processed by MyPostProcessor");
}