本文整理汇总了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);
}
}
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}