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

The following examples show how to use org.springframework.beans.factory.support.AbstractBeanDefinition#setParentName() . 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: GroovyBeanDefinitionWrapper.java    From spring-analysis-note with MIT License 6 votes vote down vote up
protected AbstractBeanDefinition createBeanDefinition() {
	AbstractBeanDefinition bd = new GenericBeanDefinition();
	bd.setBeanClass(this.clazz);
	if (!CollectionUtils.isEmpty(this.constructorArgs)) {
		ConstructorArgumentValues cav = new ConstructorArgumentValues();
		for (Object constructorArg : this.constructorArgs) {
			cav.addGenericArgumentValue(constructorArg);
		}
		bd.setConstructorArgumentValues(cav);
	}
	if (this.parentName != null) {
		bd.setParentName(this.parentName);
	}
	this.definitionWrapper = new BeanWrapperImpl(bd);
	return bd;
}
 
Example 2
Source File: GroovyBeanDefinitionWrapper.java    From java-technology-stack with MIT License 6 votes vote down vote up
protected AbstractBeanDefinition createBeanDefinition() {
	AbstractBeanDefinition bd = new GenericBeanDefinition();
	bd.setBeanClass(this.clazz);
	if (!CollectionUtils.isEmpty(this.constructorArgs)) {
		ConstructorArgumentValues cav = new ConstructorArgumentValues();
		for (Object constructorArg : this.constructorArgs) {
			cav.addGenericArgumentValue(constructorArg);
		}
		bd.setConstructorArgumentValues(cav);
	}
	if (this.parentName != null) {
		bd.setParentName(this.parentName);
	}
	this.definitionWrapper = new BeanWrapperImpl(bd);
	return bd;
}
 
Example 3
Source File: GroovyBeanDefinitionWrapper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected AbstractBeanDefinition createBeanDefinition() {
	AbstractBeanDefinition bd = new GenericBeanDefinition();
	bd.setBeanClass(this.clazz);
	if (!CollectionUtils.isEmpty(this.constructorArgs)) {
		ConstructorArgumentValues cav = new ConstructorArgumentValues();
		for (Object constructorArg : this.constructorArgs) {
			cav.addGenericArgumentValue(constructorArg);
		}
		bd.setConstructorArgumentValues(cav);
	}
	if (this.parentName != null) {
		bd.setParentName(this.parentName);
	}
	this.definitionWrapper = new BeanWrapperImpl(bd);
	return bd;
}
 
Example 4
Source File: GroovyBeanDefinitionWrapper.java    From blog_demos with Apache License 2.0 6 votes vote down vote up
protected AbstractBeanDefinition createBeanDefinition() {
	AbstractBeanDefinition bd = new GenericBeanDefinition();
	bd.setBeanClass(this.clazz);
	if (!CollectionUtils.isEmpty(this.constructorArgs)) {
		ConstructorArgumentValues cav = new ConstructorArgumentValues();
		for (Object constructorArg : this.constructorArgs) {
			cav.addGenericArgumentValue(constructorArg);
		}
		bd.setConstructorArgumentValues(cav);
	}
	if (this.parentName != null) {
		bd.setParentName(this.parentName);
	}
	this.definitionWrapper = new BeanWrapperImpl(bd);
	return bd;
}
 
Example 5
Source File: GroovyBeanDefinitionWrapper.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
protected AbstractBeanDefinition createBeanDefinition() {
	AbstractBeanDefinition bd = new GenericBeanDefinition();
	bd.setBeanClass(this.clazz);
	if (!CollectionUtils.isEmpty(this.constructorArgs)) {
		ConstructorArgumentValues cav = new ConstructorArgumentValues();
		for (Object constructorArg : this.constructorArgs) {
			cav.addGenericArgumentValue(constructorArg);
		}
		bd.setConstructorArgumentValues(cav);
	}
	if (this.parentName != null) {
		bd.setParentName(this.parentName);
	}
	this.definitionWrapper = new BeanWrapperImpl(bd);
	return bd;
}
 
Example 6
Source File: MulCommonBaseServiceParser.java    From zxl with Apache License 2.0 6 votes vote down vote up
private BeanDefinition buildSessionFactoryBeanDefinition(Element element, String name, BeanDefinitionParserDelegate beanDefinitionParserDelegate, BeanDefinitionRegistry beanDefinitionRegistry) {
	AbstractBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setAttribute(ID_ATTRIBUTE, name + SESSION_FACTORY_SUFFIX);
	beanDefinition.setBeanClass(LocalSessionFactoryBean.class);
	beanDefinition.setParentName(SESSION_FACTORY_PARENT_BEAN_NAME);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	propertyValues.add("dataSource", new RuntimeBeanReference(name + DATA_SOURCE_SUFFIX));
	if (element.hasAttribute(TABLE_PREFIX_NAME) && !StringUtil.isEmpty(element.getAttribute(TABLE_PREFIX_NAME))) {
		AbstractBeanDefinition namingStrategyBeanDefinition = new GenericBeanDefinition();
		String randomBeanName = UUID.randomUUID().toString();
		namingStrategyBeanDefinition.setAttribute(ID_ATTRIBUTE, randomBeanName);
		namingStrategyBeanDefinition.setBeanClass(HibernateNamingStrategy.class);
		MutablePropertyValues mutablePropertyValues = new MutablePropertyValues();
		mutablePropertyValues.add("prefix", element.getAttribute(TABLE_PREFIX_NAME));
		namingStrategyBeanDefinition.setPropertyValues(mutablePropertyValues);
		beanDefinitionRegistry.registerBeanDefinition(randomBeanName, namingStrategyBeanDefinition);
		propertyValues.addPropertyValue("namingStrategy", new RuntimeBeanReference(randomBeanName));
	}
	beanDefinition.setPropertyValues(propertyValues);
	beanDefinitionParserDelegate.parsePropertyElements(element, beanDefinition);
	return beanDefinition;
}
 
Example 7
Source File: MulCommonBaseServiceParser.java    From zxl with Apache License 2.0 5 votes vote down vote up
private BeanDefinition buildSqlSessionFactoryBeanDefinition(Element element, String name) {
	AbstractBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setAttribute(ID_ATTRIBUTE, name + SQL_SESSION_FACTORY_SUFFIX);
	beanDefinition.setBeanClass(SqlSessionFactoryBean.class);
	beanDefinition.setParentName(SQL_SESSION_FACTORY_PARENT_BEAN_NAME);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	propertyValues.add("dataSource", new RuntimeBeanReference(name + DATA_SOURCE_SUFFIX));
	propertyValues.add("mapperLocations", MAPPER_LOCATIONS_PREFIX + name + MAPPER_LOCATIONS_SUFFIX);
	beanDefinition.setPropertyValues(propertyValues);
	return beanDefinition;
}