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


Java BeanDefinitionBuilder.addConstructorArgValue方法代码示例

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


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

示例1: registerBeanDefinitions

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
		BeanDefinitionRegistry registry) {
	ComposedTaskProperties properties = composedTaskProperties();
	TaskParser taskParser = new TaskParser("bean-registration",
			properties.getGraph(), false, true);
	Map<String, Integer> taskSuffixMap = getTaskApps(taskParser);
	for (String taskName : taskSuffixMap.keySet()) {
		//handles the possibility that multiple instances of
		// task definition exist in a composed task
		for (int taskSuffix = 0; taskSuffixMap.get(taskName) >= taskSuffix; taskSuffix++) {
			BeanDefinitionBuilder builder = BeanDefinitionBuilder
					.rootBeanDefinition(ComposedTaskRunnerStepFactory.class);
			builder.addConstructorArgValue(properties);
			builder.addConstructorArgValue(String.format("%s_%s",
					taskName, taskSuffix));
			builder.addPropertyValue("taskSpecificProps",
					getPropertiesForTask(taskName, properties));
			builder.addPropertyValue("arguments", properties.getComposedTaskArguments());

			registry.registerBeanDefinition(String.format("%s_%s",
					taskName, taskSuffix), builder.getBeanDefinition());
		}
	}
}
 
开发者ID:spring-cloud-task-app-starters,项目名称:composed-task-runner,代码行数:26,代码来源:StepBeanDefinitionRegistrar.java

示例2: parseClusterFailureDetection

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private void parseClusterFailureDetection(BeanDefinitionBuilder cluster, Element clusterEl, ParserContext ctx) {
    Element detectionEl = getChildElementByTagName(clusterEl, "failure-detection");

    if (detectionEl != null) {
        Element heartbeatEl = getChildElementByTagName(detectionEl, "heartbeat");

        if (heartbeatEl != null) {
            BeanDefinitionBuilder heartbeatCfg = newBean(DefaultFailureDetectorConfig.class, heartbeatEl);

            setProperty(heartbeatCfg, heartbeatEl, "heartbeatInterval", "interval-ms");
            setProperty(heartbeatCfg, heartbeatEl, "heartbeatLossThreshold", "loss-threshold");
            setProperty(heartbeatCfg, heartbeatEl, "failureDetectionQuorum", "quorum");

            BeanDefinitionBuilder heartbeat = newBean(DefaultFailureDetector.class, heartbeatEl);

            heartbeat.addConstructorArgValue(registerInnerBean(heartbeatCfg, ctx));

            cluster.addPropertyValue("failureDetector", registerInnerBean(heartbeat, ctx));
        } else {
            setBeanOrRef(cluster, detectionEl, "failureDetector", "custom-detector", ctx);
        }
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:24,代码来源:HekateBeanDefinitionParser.java

示例3: parseDeclareParents

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
/**
 * Parse a '{@code declare-parents}' element and register the appropriate
 * DeclareParentsAdvisor with the BeanDefinitionRegistry encapsulated in the
 * supplied ParserContext.
 */
private AbstractBeanDefinition parseDeclareParents(Element declareParentsElement, ParserContext parserContext) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(DeclareParentsAdvisor.class);
	builder.addConstructorArgValue(declareParentsElement.getAttribute(IMPLEMENT_INTERFACE));
	builder.addConstructorArgValue(declareParentsElement.getAttribute(TYPE_PATTERN));

	String defaultImpl = declareParentsElement.getAttribute(DEFAULT_IMPL);
	String delegateRef = declareParentsElement.getAttribute(DELEGATE_REF);

	if (StringUtils.hasText(defaultImpl) && !StringUtils.hasText(delegateRef)) {
		builder.addConstructorArgValue(defaultImpl);
	}
	else if (StringUtils.hasText(delegateRef) && !StringUtils.hasText(defaultImpl)) {
		builder.addConstructorArgReference(delegateRef);
	}
	else {
		parserContext.getReaderContext().error(
				"Exactly one of the " + DEFAULT_IMPL + " or " + DELEGATE_REF + " attributes must be specified",
				declareParentsElement, this.parseState.snapshot());
	}

	AbstractBeanDefinition definition = builder.getBeanDefinition();
	definition.setSource(parserContext.extractSource(declareParentsElement));
	parserContext.getReaderContext().registerWithGeneratedName(definition);
	return definition;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ConfigBeanDefinitionParser.java

示例4: parseInternal

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
    BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(ZookeeperRegistryCenter.class);
    result.addConstructorArgValue(buildZookeeperConfigurationBeanDefinition(element, parserContext));
    result.setInitMethodName("init");
    return result.getBeanDefinition();
}
 
开发者ID:imadcn,项目名称:idworker,代码行数:8,代码来源:RegistryBeanDefinitionParser.java

示例5: parseInternal

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
    BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(generatorClass);
    result.addConstructorArgValue(buildWorkerNodeRegisterBeanDefinition(element, parserContext));
    result.setInitMethodName("init");
    return result.getBeanDefinition();
}
 
开发者ID:imadcn,项目名称:idworker,代码行数:8,代码来源:GeneratorBeanDefinitionParser.java

示例6: createTrackerBpp

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private BeanDefinition createTrackerBpp(Element elem, BeanDefinitionHolder definition) {
	BeanDefinitionBuilder builder =
			BeanDefinitionBuilder.genericBeanDefinition(ManagedServiceInstanceTrackerPostProcessor.class).setRole(
					BeanDefinition.ROLE_INFRASTRUCTURE);
	builder.addConstructorArgValue(definition.getBeanName());
	ParserUtils.parseCustomAttributes(elem, builder, (AttributeCallback[]) null);
	return builder.getBeanDefinition();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:9,代码来源:ManagedPropertiesDefinitionParser.java

示例7: parseInternal

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {

		BeanDefinitionBuilder registrarDefinitionBuilder =
				BeanDefinitionBuilder.genericBeanDefinition(BlueprintConverterConfigurer.class);

		List<Element> components = DomUtils.getChildElementsByTagName(element, BlueprintParser.BEAN);
		List<Element> componentRefs =
				DomUtils.getChildElementsByTagName(element, BeanDefinitionParserDelegate.REF_ELEMENT);

		ManagedList<Object> converterList = new ManagedList<Object>(componentRefs.size() + components.size());

		// add components
		for (Element component : components) {
			converterList.add(BlueprintParser.parsePropertySubElement(parserContext, component,
					registrarDefinitionBuilder.getBeanDefinition()));
		}
		// followed by bean references
		for (Element componentRef : componentRefs) {
			converterList.add(BlueprintParser.parsePropertySubElement(parserContext, componentRef,
					registrarDefinitionBuilder.getBeanDefinition()));
		}
		// add the list to the registrar definition
		registrarDefinitionBuilder.addConstructorArgValue(converterList);
		registrarDefinitionBuilder.setRole(BeanDefinition.ROLE_SUPPORT);
		registrarDefinitionBuilder.getRawBeanDefinition().setSynthetic(true);

		// build the CustomEditorConfigurer
		return registrarDefinitionBuilder.getBeanDefinition();
	}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:TypeConverterBeanDefinitionParser.java

示例8: runnableReference

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private RuntimeBeanReference runnableReference(String ref, String method, Element taskElement, ParserContext parserContext) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
			"org.springframework.scheduling.support.ScheduledMethodRunnable");
	builder.addConstructorArgReference(ref);
	builder.addConstructorArgValue(method);
	return beanReference(taskElement, parserContext, builder);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ScheduledTasksBeanDefinitionParser.java

示例9: intervalTaskReference

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private RuntimeBeanReference intervalTaskReference(String runnableBeanName,
		String initialDelay, String interval, Element taskElement, ParserContext parserContext) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
			"org.springframework.scheduling.config.IntervalTask");
	builder.addConstructorArgReference(runnableBeanName);
	builder.addConstructorArgValue(interval);
	builder.addConstructorArgValue(StringUtils.hasLength(initialDelay) ? initialDelay : ZERO_INITIAL_DELAY);
	return beanReference(taskElement, parserContext, builder);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ScheduledTasksBeanDefinitionParser.java

示例10: cronTaskReference

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private RuntimeBeanReference cronTaskReference(String runnableBeanName,
		String cronExpression, Element taskElement, ParserContext parserContext) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
			"org.springframework.scheduling.config.CronTask");
	builder.addConstructorArgReference(runnableBeanName);
	builder.addConstructorArgValue(cronExpression);
	return beanReference(taskElement, parserContext, builder);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:ScheduledTasksBeanDefinitionParser.java

示例11: createDatabasePopulator

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
static private BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);

	boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
	boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");

	ManagedList<BeanMetadataElement> delegates = new ManagedList<BeanMetadataElement>();
	for (Element scriptElement : scripts) {
		String executionAttr = scriptElement.getAttribute("execution");
		if (!StringUtils.hasText(executionAttr)) {
			executionAttr = "INIT";
		}
		if (!execution.equals(executionAttr)) {
			continue;
		}
		BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
		delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
		delegate.addPropertyValue("continueOnError", continueOnError);

		// Use a factory bean for the resources so they can be given an order if a pattern is used
		BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
		resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
		delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
		if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
			delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
		}
		if (StringUtils.hasLength(scriptElement.getAttribute("separator"))) {
			delegate.addPropertyValue("separator", new TypedStringValue(scriptElement.getAttribute("separator")));
		}
		delegates.add(delegate.getBeanDefinition());
	}
	builder.addPropertyValue("populators", delegates);

	return builder.getBeanDefinition();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:DatabasePopulatorConfigUtils.java

示例12: createDataSource

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected final AbstractBeanDefinition createDataSource(MybatisNodeProperties druidNodeConfig,
		DruidProperties defaultConfig, String dataSourceName) {
	Assert.notNull(druidNodeConfig, String
			.format("DynamicDataSource 未初始化 ,dataSourceName=%s,失败原因: 配置参数为空,你的配置可能存在问题!", dataSourceName + ""));
	BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(DynamicDataSource.class);
	definitionBuilder.addConstructorArgValue(druidNodeConfig);
	definitionBuilder.addConstructorArgValue(defaultConfig);
	definitionBuilder.addConstructorArgValue(dataSourceName);
	definitionBuilder.setInitMethodName("init");
	definitionBuilder.setDestroyMethodName("close");
	return definitionBuilder.getRawBeanDefinition();
}
 
开发者ID:halober,项目名称:spring-boot-starter-dao,代码行数:13,代码来源:AbstractDataBaseBean.java

示例13: doParse

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected void doParse(Element element, BeanDefinitionBuilder bean) {
	String name = element.getAttribute("name");
	bean.addConstructorArgValue(name);

	String parents = element.getAttribute("parentNames");
	List<String> parentList = null == parents ? null :
		Splitter.on(',').trimResults().omitEmptyStrings().splitToList(parents);
	bean.addConstructorArgValue(null == parentList ? Collections.emptyList() : parentList);
}
 
开发者ID:qas-guru,项目名称:martini-core,代码行数:10,代码来源:MartiniCategoryBeanDefinitionParser.java

示例14: buildBeanDefinition

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private BeanDefinition buildBeanDefinition(String factoryMethod, DoubleDefinition doubleDefinition, Object... constructorArgs) {
	final BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
			.rootBeanDefinition(doubleDefinition.getDoubleClass())
			.setFactoryMethodOnBean(factoryMethod, DOUBLE_FACTORY_BEAN_NAME);

	for (Object constructorArg : constructorArgs) {
		definitionBuilder.addConstructorArgValue(constructorArg);
	}

	final RootBeanDefinition beanDefinition = (RootBeanDefinition) definitionBuilder.getBeanDefinition();
	beanDefinition.setTargetType(doubleDefinition.getDoubleClass());

	return beanDefinition;
}
 
开发者ID:pchudzik,项目名称:springmock,代码行数:15,代码来源:DoubleDefinitionsRegistrationContext.java

示例15: buildWorkerNodeRegisterBeanDefinition

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private AbstractBeanDefinition buildWorkerNodeRegisterBeanDefinition(final Element element, final ParserContext parserContext) {
	 BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(ZookeeperWorkerRegister.class);
	 result.addConstructorArgReference(element.getAttribute(GeneratorBeanDefinitionTag.REGISTRY_CENTER_REF));
	 result.addConstructorArgValue(buildApplicationConfigurationBeanDefinition(element, parserContext));
	 return result.getBeanDefinition();
}
 
开发者ID:imadcn,项目名称:idworker,代码行数:7,代码来源:GeneratorBeanDefinitionParser.java


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