当前位置: 首页>>代码示例>>Java>>正文


Java BeanDefinitionBuilder.setScope方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.support.BeanDefinitionBuilder.setScope方法的典型用法代码示例。如果您正苦于以下问题:Java BeanDefinitionBuilder.setScope方法的具体用法?Java BeanDefinitionBuilder.setScope怎么用?Java BeanDefinitionBuilder.setScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.support.BeanDefinitionBuilder的用法示例。


在下文中一共展示了BeanDefinitionBuilder.setScope方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerBean

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
/**
 * 动态注册一个Bean动Spring容器中
 *
 * @param beanName  名称
 * @param beanClazz 定义bean
 */
public void registerBean(String beanName, Class beanClazz, Map<String, Object> propertys) {
    Assert.notNull(beanName);
    Assert.notNull(beanClazz);
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(beanClazz);
    if (propertys != null) {
        propertys.forEach((k, v) -> builder.addPropertyValue(k, v));
    }
    builder.setScope(BeanDefinition.SCOPE_SINGLETON);
    registerBean(beanName, builder.getBeanDefinition());

}
 
开发者ID:yu199195,项目名称:happylifeplat-transaction,代码行数:18,代码来源:SpringBeanUtils.java

示例2: createBeanDefinitionBuilder

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
public BeanDefinitionBuilder createBeanDefinitionBuilder(Element element, ParserContext parserContext, Class<?> cls) {
    BeanDefinitionBuilder builder
            = BeanDefinitionBuilder.genericBeanDefinition();
    builder.getRawBeanDefinition().setBeanClass(cls);
    builder.getRawBeanDefinition()
            .setSource(parserContext.extractSource(element));
    if (parserContext.isNested()) {
        builder.setScope(parserContext.getContainingBeanDefinition()
                .getScope());
    }
    if (parserContext.isDefaultLazyInit()) {
        builder.setLazyInit(true);
    }
    return builder;
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:16,代码来源:RedissonNamespaceParserSupport.java

示例3: registerBean

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
/**
 * 动态注册一个Bean动Spring容器中
 *
 * @param beanName  名称
 * @param beanClazz 定义bean
 */
public void registerBean(String beanName, Class beanClazz, Map<String, Object> propertys) {
    AssertUtils.notNull(beanName);
    AssertUtils.notNull(beanClazz);
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(beanClazz);
    if (propertys != null) {
        propertys.forEach((k, v) -> builder.addPropertyValue(k, v));
    }
    builder.setScope(BeanDefinition.SCOPE_SINGLETON);
    registerBean(beanName, builder.getBeanDefinition());

}
 
开发者ID:yu199195,项目名称:happylifeplat-tcc,代码行数:18,代码来源:SpringBeanUtils.java

示例4: applyDefaults

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected void applyDefaults(ParserContext parserContext, OsgiDefaultsDefinition defaults,
		BeanDefinitionBuilder builder) {
	if (parserContext.isNested()) {
		// Inner bean definition must receive same scope as containing bean.
		builder.setScope(parserContext.getContainingBeanDefinition().getScope());
	}
	if (parserContext.isDefaultLazyInit()) {
		// Default-lazy-init applies to custom bean definitions as well.
		builder.setLazyInit(true);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:AbstractReferenceDefinitionParser.java

示例5: doParse

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
	String listClass = element.getAttribute("list-class");
	List<Object> parsedList = parserContext.getDelegate().parseListElement(element, builder.getRawBeanDefinition());
	builder.addPropertyValue("sourceList", parsedList);
	if (StringUtils.hasText(listClass)) {
		builder.addPropertyValue("targetListClass", listClass);
	}
	String scope = element.getAttribute(SCOPE_ATTRIBUTE);
	if (StringUtils.hasLength(scope)) {
		builder.setScope(scope);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:UtilNamespaceHandler.java

示例6: parseInternal

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
/**
 * Creates a {@link BeanDefinitionBuilder} instance for the
 * {@link #getBeanClass bean Class} and passes it to the
 * {@link #doParse} strategy method.
 * @param element the element that is to be parsed into a single BeanDefinition
 * @param parserContext the object encapsulating the current state of the parsing process
 * @return the BeanDefinition resulting from the parsing of the supplied {@link Element}
 * @throws IllegalStateException if the bean {@link Class} returned from
 * {@link #getBeanClass(org.w3c.dom.Element)} is {@code null}
 * @see #doParse
 */
@Override
protected final AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition();
	String parentName = getParentName(element);
	if (parentName != null) {
		builder.getRawBeanDefinition().setParentName(parentName);
	}
	Class<?> beanClass = getBeanClass(element);
	if (beanClass != null) {
		builder.getRawBeanDefinition().setBeanClass(beanClass);
	}
	else {
		String beanClassName = getBeanClassName(element);
		if (beanClassName != null) {
			builder.getRawBeanDefinition().setBeanClassName(beanClassName);
		}
	}
	builder.getRawBeanDefinition().setSource(parserContext.extractSource(element));
	if (parserContext.isNested()) {
		// Inner bean definition must receive same scope as containing bean.
		builder.setScope(parserContext.getContainingBeanDefinition().getScope());
	}
	if (parserContext.isDefaultLazyInit()) {
		// Default-lazy-init applies to custom bean definitions as well.
		builder.setLazyInit(true);
	}
	doParse(element, parserContext, builder);
	return builder.getBeanDefinition();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:AbstractSingleBeanDefinitionParser.java


注:本文中的org.springframework.beans.factory.support.BeanDefinitionBuilder.setScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。