本文整理匯總了Java中org.springframework.beans.factory.support.AbstractBeanDefinition.setFactoryBeanName方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractBeanDefinition.setFactoryBeanName方法的具體用法?Java AbstractBeanDefinition.setFactoryBeanName怎麽用?Java AbstractBeanDefinition.setFactoryBeanName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.support.AbstractBeanDefinition
的用法示例。
在下文中一共展示了AbstractBeanDefinition.setFactoryBeanName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseConfigTypes
import org.springframework.beans.factory.support.AbstractBeanDefinition; //導入方法依賴的package包/類
private void parseConfigTypes(Element element, String configType, BeanDefinitionBuilder redissonDef, ParserContext parserContext) {
BeanDefinitionBuilder builder
= helper.createBeanDefinitionBuilder(element,
parserContext, null);
//Use factory method on the Config bean
AbstractBeanDefinition bd = builder.getRawBeanDefinition();
bd.setFactoryMethodName("use" + StringUtils.capitalize(configType));
bd.setFactoryBeanName(parserContext.getContainingComponent().getName());
String id = parserContext.getReaderContext().generateBeanName(bd);
helper.registerBeanDefinition(builder, id,
helper.parseAliase(element), parserContext);
helper.parseAttributes(element, parserContext, builder);
redissonDef.addDependsOn(id);
parseChildElements(element, id, null, redissonDef, parserContext);
parserContext.getDelegate().parseQualifierElements(element, bd);
}
示例2: parseAttributes
import org.springframework.beans.factory.support.AbstractBeanDefinition; //導入方法依賴的package包/類
private AbstractBeanDefinition parseAttributes(Element ele, String beanName, AbstractBeanDefinition beanDefinition) {
AbstractBeanDefinition bd =
parserContext.getDelegate().parseBeanDefinitionAttributes(ele, beanName, null, beanDefinition);
// handle lazy flag (initialize)
String lazyInit = ele.getAttribute(LAZY_INIT_ATTR);
// check whether the value is "lazy"
if (StringUtils.hasText(lazyInit)) {
if (lazyInit.equalsIgnoreCase(LAZY_INIT_VALUE)) {
bd.setLazyInit(true);
} else {
bd.setLazyInit(false);
}
} else {
bd.setLazyInit(getDefaults(ele).getDefaultInitialization());
}
// handle factory component
String componentFactory = ele.getAttribute(FACTORY_REF_ATTR);
if (StringUtils.hasText(componentFactory)) {
bd.setFactoryBeanName(componentFactory);
}
// check whether the bean is a prototype with destroy method
if (StringUtils.hasText(bd.getDestroyMethodName())
&& BeanDefinition.SCOPE_PROTOTYPE.equalsIgnoreCase(bd.getScope())) {
error("Blueprint prototype beans cannot define destroy methods", ele);
}
return bd;
}
示例3: setProperty
import org.springframework.beans.factory.support.AbstractBeanDefinition; //導入方法依賴的package包/類
public void setProperty(String property, Object newValue) {
if (PARENT.equals(property)) {
setParent(newValue);
}
else {
AbstractBeanDefinition bd = getBeanDefinition();
if (AUTOWIRE.equals(property)) {
if ("byName".equals(newValue)) {
bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
}
else if ("byType".equals(newValue)) {
bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE);
}
else if ("constructor".equals(newValue)) {
bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR);
}
else if (Boolean.TRUE.equals(newValue)) {
bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
}
}
// constructorArgs
else if (CONSTRUCTOR_ARGS.equals(property) && newValue instanceof List) {
ConstructorArgumentValues cav = new ConstructorArgumentValues();
List args = (List) newValue;
for (Object arg : args) {
cav.addGenericArgumentValue(arg);
}
bd.setConstructorArgumentValues(cav);
}
// factoryBean
else if (FACTORY_BEAN.equals(property)) {
if (newValue != null) {
bd.setFactoryBeanName(newValue.toString());
}
}
// factoryMethod
else if (FACTORY_METHOD.equals(property)) {
if (newValue != null)
bd.setFactoryMethodName(newValue.toString());
}
// initMethod
else if (INIT_METHOD.equals(property)) {
if (newValue != null) {
bd.setInitMethodName(newValue.toString());
}
}
// destroyMethod
else if (DESTROY_METHOD.equals(property)) {
if (newValue != null) {
bd.setDestroyMethodName(newValue.toString());
}
}
// singleton property
else if (SINGLETON.equals(property)) {
bd.setScope(Boolean.TRUE.equals(newValue) ?
BeanDefinition.SCOPE_SINGLETON : BeanDefinition.SCOPE_PROTOTYPE);
}
else if (this.definitionWrapper.isWritableProperty(property)) {
this.definitionWrapper.setPropertyValue(property, newValue);
}
else {
super.setProperty(property, newValue);
}
}
}