Java Code Examples for org.springframework.beans.factory.support.AbstractBeanDefinition#setDescription()

The following examples show how to use org.springframework.beans.factory.support.AbstractBeanDefinition#setDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationConfigUtils.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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"));
		}
	}
}
 
Example 2
Source File: AnnotationConfigUtils.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
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"));
		}
	}
}
 
Example 3
Source File: CustomBeanDefinitionParser.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
	}
	
}
 
Example 4
Source File: Spr7167Tests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	AbstractBeanDefinition bd = (AbstractBeanDefinition) beanFactory.getBeanDefinition("someDependency");
	bd.setDescription("post processed by MyPostProcessor");
}
 
Example 5
Source File: Spr7167Tests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	AbstractBeanDefinition bd = (AbstractBeanDefinition) beanFactory.getBeanDefinition("someDependency");
	bd.setDescription("post processed by MyPostProcessor");
}
 
Example 6
Source File: Spr7167Tests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	AbstractBeanDefinition bd = (AbstractBeanDefinition) beanFactory.getBeanDefinition("someDependency");
	bd.setDescription("post processed by MyPostProcessor");
}