下面列出了org.springframework.beans.factory.support.AbstractBeanDefinition#setParentName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}