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


Java BeanDefinitionBuilder.addPropertyValue方法代码示例

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


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

示例1: buildExporter

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private AbstractBeanDefinition buildExporter(ServiceMetadata metadata) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(EXPORTER_CLASS);
	// add properties
	builder.addPropertyValue(EXPORTER_RANKING_PROP, metadata.getRanking());
	builder.addPropertyValue(EXPORTER_INTFS_PROP, metadata.getInterfaces());
	builder.addPropertyValue(EXPORTER_PROPS_PROP, metadata.getServiceProperties());
	builder.addPropertyValue(EXPORTER_AUTO_EXPORT_PROP,
			DefaultInterfaceDetector.values()[metadata.getAutoExport() - 1]);

	BeanMetadataElement beanMetadata = BeanMetadataElementFactory.buildBeanMetadata(metadata.getServiceComponent());
	if (beanMetadata instanceof RuntimeBeanReference) {
		builder.addPropertyValue(EXPORTER_TARGET_BEAN_NAME_PROP, beanMetadata);
	} else {
		builder.addPropertyValue(EXPORTER_TARGET_BEAN_PROP, beanMetadata);
	}

	// FIXME: add registration listeners

	return builder.getBeanDefinition();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:21,代码来源:BeanDefinitionFactory.java

示例2: createSqlSessionFactoryBean

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected final AbstractBeanDefinition createSqlSessionFactoryBean(String dataSourceName, String mapperPackage,
		String typeAliasesPackage, Dialect dialect, Configuration configuration) {
	configuration.setDatabaseId(dataSourceName);
	BeanDefinitionBuilder bdb = BeanDefinitionBuilder.rootBeanDefinition(SqlSessionFactoryBean.class);
	bdb.addPropertyValue("configuration", configuration);
	bdb.addPropertyValue("failFast", true);
	bdb.addPropertyValue("typeAliases", this.saenTypeAliases(typeAliasesPackage));
	bdb.addPropertyReference("dataSource", dataSourceName);
	bdb.addPropertyValue("plugins", new Interceptor[] { new CustomPageInterceptor(dialect) });
	if (!StringUtils.isEmpty(mapperPackage)) {
		try {
			mapperPackage = new StandardEnvironment().resolveRequiredPlaceholders(mapperPackage);
			String mapperPackages = ClassUtils.convertClassNameToResourcePath(mapperPackage);
			String mapperPackagePath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + mapperPackages + "/*.xml";
			Resource[] resources = new PathMatchingResourcePatternResolver().getResources(mapperPackagePath);
			bdb.addPropertyValue("mapperLocations", resources);
		} catch (Exception e) {
			log.error("初始化失败", e);
			throw new RuntimeException( String.format("SqlSessionFactory 初始化失败  mapperPackage=%s", mapperPackage + ""));
		}
	}
	return bdb.getBeanDefinition();
}
 
开发者ID:halober,项目名称:spring-boot-starter-dao,代码行数:24,代码来源:AbstractDataBaseBean.java

示例3: parseAttributes

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
public void parseAttributes(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    NamedNodeMap attributes = element.getAttributes();
    for (int x = 0; x < attributes.getLength(); x++) {
        Attr attribute = (Attr) attributes.item(x);
        if (isEligibleAttribute(attribute)) {
            String propertyName
                    = attribute.getLocalName().endsWith(REF_SUFFIX)
                            ? attribute.getLocalName()
                                    .substring(0, attribute.getLocalName()
                                            .length() - REF_SUFFIX.length())
                            : attribute.getLocalName();
            propertyName = Conventions
                    .attributeNameToPropertyName(propertyName);
            Assert.state(StringUtils.hasText(propertyName),
                    "Illegal property name returned from"
                            + " 'extractPropertyName(String)': cannot be"
                            + " null or empty.");
            if (attribute.getLocalName().endsWith(REF_SUFFIX)) {
                builder.addPropertyReference(propertyName,
                        attribute.getValue());
            } else {
                builder.addPropertyValue(propertyName, attribute.getValue());
            }
        }
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:RedissonNamespaceParserSupport.java

示例4: doParse

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
	builder.addPropertyReference("cacheManager", CacheNamespaceHandler.extractCacheManager(element));
	CacheNamespaceHandler.parseKeyGenerator(element, builder.getBeanDefinition());

	List<Element> cacheDefs = DomUtils.getChildElementsByTagName(element, DEFS_ELEMENT);
	if (cacheDefs.size() >= 1) {
		// Using attributes source.
		List<RootBeanDefinition> attributeSourceDefinitions = parseDefinitionsSources(cacheDefs, parserContext);
		builder.addPropertyValue("cacheOperationSources", attributeSourceDefinitions);
	} else {
		// Assume annotations source.
		builder.addPropertyValue("cacheOperationSources", new RootBeanDefinition(
				AnnotationCacheOperationSource.class));
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:CacheAdviceParser.java

示例5: doParse

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected void doParse(Element element,ParserContext parserContext,BeanDefinitionBuilder builder) {
	String id=element.getAttribute("id");
	if(StringUtils.isNotEmpty(id))hasId=false;
	String dataSourceRegisterName=element.getAttribute("dataSourceRegisterName");
	builder.addPropertyValue("dataSourceName", dataSourceRegisterName);
	builder.addPropertyReference("entityInterceptor", UnByteCodeProxyInterceptor.BEAN_ID);
	NodeList nodeList=element.getChildNodes();
	for(int i=0;i<nodeList.getLength();i++){
		Node node=nodeList.item(i);
		String nodeName=parserContext.getDelegate().getLocalName(node);
		IElementParser<?> parser=parserMap.get(nodeName);
		if(parser!=null){
			builder.addPropertyValue(parser.propertyName(), parser.parse(node, parserContext));
		}
	}
	String scanPackages=element.getAttribute("scanPackages");
	if(StringUtils.isNotEmpty(scanPackages)){
		builder.addPropertyValue("scanPackages", scanPackages.split(","));			
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:22,代码来源:SessionFactoryBeanParser.java

示例6: doParse

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

        try {
            String timeOut = element.getAttribute("timeout");
            String targetInterface = element.getAttribute("interface");
            String clusterStrategy = element.getAttribute("clusterStrategy");
            String remoteAppKey = element.getAttribute("remoteAppKey");
            String groupName = element.getAttribute("groupName");

            bean.addPropertyValue("timeout", Integer.parseInt(timeOut));
            bean.addPropertyValue("targetInterface", Class.forName(targetInterface));
            bean.addPropertyValue("remoteAppKey", remoteAppKey);

            if (StringUtils.isNotBlank(clusterStrategy)) {
                bean.addPropertyValue("clusterStrategy", clusterStrategy);
            }
            if (StringUtils.isNotBlank(groupName)) {
                bean.addPropertyValue("groupName", groupName);
            }
        } catch (Exception e) {
            logger.error("RevokerFactoryBeanDefinitionParser error.", e);
            throw new RuntimeException(e);
        }

    }
 
开发者ID:linuer,项目名称:nan,代码行数:26,代码来源:RevokerFactoryBeanDefinitionParser.java

示例7: process

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
public boolean process(Element parent, Attr attribute, BeanDefinitionBuilder builder) {
	String name = attribute.getLocalName();
	String value = attribute.getValue();

	if (ACTIVATION.equals(name)) {
		builder.addPropertyValue(LAZY_LISTENERS, Boolean.valueOf(value.startsWith("l")));
		return false;
	}

	return true;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:BlueprintServiceDefinitionParser.java

示例8: parserFieldMixCommonFirst

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private void parserFieldMixCommonFirst(BeanDefinitionBuilder builder, List<Element> eles)
{
	if (!CollectionUtils.isEmpty(eles)) {

		Field[] firstFields = new Field[eles.size()];
		for (int i = 0; i < eles.size(); i++) {
			firstFields[i] = parserField(eles.get(i),false);
		}
		builder.addPropertyValue("firstFields", firstFields);
	}
}
 
开发者ID:yanghao0518,项目名称:cstruct-parser,代码行数:12,代码来源:CjavaTcTemplateBeanDefinitionParser.java

示例9: registerListener

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private void registerListener(String registerBeanName,Destination destination,Object bean,Method method,int retryTimes,boolean isRetry){
	DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory)this.applicationContext.getAutowireCapableBeanFactory();  
         
       BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultMessageListenerContainer.class);  
       beanDefinitionBuilder.addPropertyValue("connectionFactory",this.connectionFactory);  
       beanDefinitionBuilder.addPropertyValue("destination", destination);  
       beanDefinitionBuilder.addPropertyValue("messageListener",new SessionAwareMessageListenerImpl(bean, method,retryTimes,isRetry,this.jmsTemplate));
       beanDefinitionBuilder.addPropertyValue("sessionAcknowledgeMode",4);
       
       beanFactory.registerBeanDefinition(registerBeanName, beanDefinitionBuilder.getBeanDefinition());
}
 
开发者ID:yanghuijava,项目名称:elephant,代码行数:12,代码来源:MQAutoConfiguration.java

示例10: postProcess

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) {
    super.postProcess(builder, source);

    builder.addPropertyValue("configuration",
            JdbcTemplateRepositoryConfiguration.create(source.getAttribute("namedParameterJdbcOperationsBeanName")));
}
 
开发者ID:cybozu,项目名称:spring-data-jdbc-template,代码行数:8,代码来源:JdbcTemplateRepositoryConfigExtension.java

示例11: doParse

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected void doParse(Element element,BeanDefinitionBuilder builder) {
	String name=element.getAttribute("name");
	String asDefault=element.getAttribute("asDefault");
	String dataSource=element.getAttribute("dataSource-ref");
	builder.addPropertyValue("name", name);
	builder.addPropertyValue("asDefault", asDefault);
	builder.addPropertyReference("dataSource", dataSource);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:10,代码来源:DataSourceRegisterBeanParser.java

示例12: parseCoordinationService

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private Optional<RuntimeBeanReference> parseCoordinationService(Element rootEl, ParserContext ctx) {
    Element coordinationEl = getChildElementByTagName(rootEl, "coordination");

    if (coordinationEl != null) {
        BeanDefinitionBuilder coordination = newBean(CoordinationServiceFactory.class, coordinationEl);

        ManagedList<RuntimeBeanReference> processes = new ManagedList<>();

        getChildElementsByTagName(coordinationEl, "process").forEach(processEl -> {
            BeanDefinitionBuilder process = newBean(CoordinationProcessConfig.class, processEl);

            setProperty(process, processEl, "name", "name");

            setBeanOrRef(process, processEl, "handler", "handler", ctx);
            setBeanOrRef(process, processEl, "messageCodec", "message-codec", ctx);

            processes.add(registerInnerBean(process, ctx));
        });

        if (!processes.isEmpty()) {
            coordination.addPropertyValue("processes", processes);
        }

        String id = coordinationEl.getAttribute("id");

        if (!id.isEmpty()) {
            deferredBaseBeans.put(newLazyBean(CoordinationServiceBean.class, coordinationEl), id);
        }

        return Optional.of(registerInnerBean(coordination, ctx));
    } else {
        return Optional.empty();
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:35,代码来源:HekateBeanDefinitionParser.java

示例13: parseControllerParameters

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected void parseControllerParameters(BeanDefinitionBuilder dwrControllerDefinition, Element parent)
{
    NodeList children = parent.getChildNodes();
    Map params = new HashMap();
    for (int i = 0; i < children.getLength(); i++)
    {
        Node node = children.item(i);

        if (node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.COMMENT_NODE)
        {
            continue;
        }

        Element child = (Element) node;
        if (child.getNodeName().equals("dwr:config-param"))
        {
            String paramName = child.getAttribute("name");
            String value = child.getAttribute("value");
            params.put(paramName, value);
        }
        else
        {
            throw new RuntimeException("an unknown dwr:controller sub node was found: " + node.getNodeName());
        }
    }
    dwrControllerDefinition.addPropertyValue("configParams", params);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:DwrNamespaceHandler.java

示例14: parseInternal

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

	// Mark as infrastructure bean and attach source location.
	builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	builder.getRawBeanDefinition().setSource(parserContext.extractSource(element));

	String defaultDomain = element.getAttribute(DEFAULT_DOMAIN_ATTRIBUTE);
	if (StringUtils.hasText(defaultDomain)) {
		builder.addPropertyValue("defaultDomain", defaultDomain);
	}

	String serverBeanName = element.getAttribute(SERVER_ATTRIBUTE);
	if (StringUtils.hasText(serverBeanName)) {
		builder.addPropertyReference("server", serverBeanName);
	}
	else {
		AbstractBeanDefinition specialServer = MBeanServerBeanDefinitionParser.findServerForSpecialEnvironment();
		if (specialServer != null) {
			builder.addPropertyValue("server", specialServer);
		}
	}

	String registration = element.getAttribute(REGISTRATION_ATTRIBUTE);
	RegistrationPolicy registrationPolicy = RegistrationPolicy.FAIL_ON_EXISTING;
	if (REGISTRATION_IGNORE_EXISTING.equals(registration)) {
		registrationPolicy = RegistrationPolicy.IGNORE_EXISTING;
	}
	else if (REGISTRATION_REPLACE_EXISTING.equals(registration)) {
		registrationPolicy = RegistrationPolicy.REPLACE_EXISTING;
	}
	builder.addPropertyValue("registrationPolicy", registrationPolicy);

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

示例15: doParse

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
protected void doParse(Element element, BeanDefinitionBuilder builder)
{

	String key = element.getAttribute("key");
	builder.addPropertyValue("key", key);
	
	setDefault(element,builder);
	
	String className = element.getAttribute("class");
	if (StringUtils.hasText(className)) {
		builder.getBeanDefinition().setBeanClassName(className);
	}

	List<Element> childElts = DomUtils.getChildElements(element);
	// 解析fields
	if (CollectionUtils.isEmpty(childElts)) {
		throw new IllegalArgumentException("cjava:header node must contain fields");
	}

	Field[] values = new Field[childElts.size()];
	for (int i = 0; i < childElts.size(); i++) {
		Element node = childElts.get(i);
		// 解析
		values[i] = parserField(node,true);
	}
	builder.addPropertyValue("fields", values);

}
 
开发者ID:yanghao0518,项目名称:cstruct-parser,代码行数:30,代码来源:CjavaFcHeaderBeanDefinitionParser.java


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