當前位置: 首頁>>代碼示例>>Java>>正文


Java GenericBeanDefinition.getPropertyValues方法代碼示例

本文整理匯總了Java中org.springframework.beans.factory.support.GenericBeanDefinition.getPropertyValues方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericBeanDefinition.getPropertyValues方法的具體用法?Java GenericBeanDefinition.getPropertyValues怎麽用?Java GenericBeanDefinition.getPropertyValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.beans.factory.support.GenericBeanDefinition的用法示例。


在下文中一共展示了GenericBeanDefinition.getPropertyValues方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerBeanDefinitions

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    Map<Object, Object> targetDataSources = new HashMap<Object, Object>();
    // 將主數據源添加到更多數據源中
    targetDataSources.put("dataSource", defaultDataSource);
    DynamicDataSourceContextHolder.dataSourceIds.add("dataSource");
    // 添加更多數據源
    targetDataSources.putAll(customDataSources);
    for (String key : customDataSources.keySet()) {
        DynamicDataSourceContextHolder.dataSourceIds.add(key);
    }

    // 創建DynamicDataSource
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClass(DynamicDataSource.class);
    beanDefinition.setSynthetic(true);
    MutablePropertyValues mpv = beanDefinition.getPropertyValues();
    mpv.addPropertyValue("defaultTargetDataSource", defaultDataSource);
    mpv.addPropertyValue("targetDataSources", targetDataSources);
    registry.registerBeanDefinition("dataSource", beanDefinition);

    logger.info("Dynamic DataSource Registry");
}
 
開發者ID:tinyoculus,項目名稱:Dynamic-data-sources,代碼行數:24,代碼來源:DynamicDataSourceRegister.java

示例2: initializeForProvider

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
public void initializeForProvider(ConfigurableListableBeanFactory beanFactory, String application, String refBeanName)
		throws BeansException {
	BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;

	// <dubbo:service interface="org.bytesoft.bytejta.supports.wire.RemoteCoordinator" group="org-bytesoft-bytetcc"
	// ref="dispatcherCoordinator" filter="compensable" loadbalance="compensable" cluster="failfast" />
	GenericBeanDefinition beanDef = new GenericBeanDefinition();
	beanDef.setBeanClass(com.alibaba.dubbo.config.spring.ServiceBean.class);

	MutablePropertyValues mpv = beanDef.getPropertyValues();
	mpv.addPropertyValue("interface", RemoteCoordinator.class.getName());
	mpv.addPropertyValue("ref", new RuntimeBeanReference(refBeanName));
	mpv.addPropertyValue("cluster", "failfast");
	mpv.addPropertyValue("loadbalance", "compensable");
	mpv.addPropertyValue("filter", "compensable");
	mpv.addPropertyValue("group", "org-bytesoft-bytetcc");
	mpv.addPropertyValue("retries", "0");
	mpv.addPropertyValue("timeout", "6000");

	String skeletonBeanId = String.format("[email protected]%s", RemoteCoordinator.class.getName());
	registry.registerBeanDefinition(skeletonBeanId, beanDef);
}
 
開發者ID:liuyangming,項目名稱:ByteTCC,代碼行數:23,代碼來源:CompensableConfigPostProcessor.java

示例3: initializeForProvider

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
public void initializeForProvider(ConfigurableListableBeanFactory beanFactory, String application, String refBeanName)
		throws BeansException {
	BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;

	GenericBeanDefinition beanDef = new GenericBeanDefinition();
	beanDef.setBeanClass(com.alibaba.dubbo.config.spring.ServiceBean.class);

	MutablePropertyValues mpv = beanDef.getPropertyValues();
	mpv.addPropertyValue("interface", RemoteCoordinator.class.getName());
	mpv.addPropertyValue("ref", new RuntimeBeanReference(refBeanName));
	mpv.addPropertyValue("cluster", "failfast");
	mpv.addPropertyValue("loadbalance", "transaction");
	mpv.addPropertyValue("filter", "transaction");
	mpv.addPropertyValue("group", "org.bytesoft.bytejta");
	mpv.addPropertyValue("retries", "0");
	mpv.addPropertyValue("timeout", "6000");

	String skeletonBeanId = String.format("[email protected]%s", RemoteCoordinator.class.getName());
	registry.registerBeanDefinition(skeletonBeanId, beanDef);
}
 
開發者ID:liuyangming,項目名稱:ByteJTA,代碼行數:21,代碼來源:TransactionConfigPostProcessor.java

示例4: registryMangoDao

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
 * 向spring中注入dao代理
 * @param beanFactory
 */
private void registryMangoDao(DefaultListableBeanFactory beanFactory){
    for (Class<?> daoClass : findMangoDaoClasses(config.getScanPackage())) {
        GenericBeanDefinition bf = new GenericBeanDefinition();
        bf.setBeanClassName(daoClass.getName());
        MutablePropertyValues pvs = bf.getPropertyValues();
        pvs.addPropertyValue("daoClass", daoClass);
        bf.setBeanClass(factoryBeanClass);
        bf.setPropertyValues(pvs);
        bf.setLazyInit(false);
        beanFactory.registerBeanDefinition(daoClass.getName(), bf);
    }
}
 
開發者ID:jfaster,項目名稱:mango-spring-boot-starter,代碼行數:17,代碼來源:MangoDaoAutoCreator.java

示例5: registerBeanDefinitions

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("動態數據源注冊開始>>>");
    }

    // 添加主數據源
    targetDataSources.put("master", DynamicDataSourceHolder.getMasterDS());
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("提供可選取Master數據源:{}", "master");
    }

    // 添加從數據源
    targetDataSources.putAll(DynamicDataSourceHolder.getSlaveDSMap());
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("提供可選取Slave數據源:{}", DynamicDataSourceHolder.getSlaveDSMap().keySet());
    }
    for (String key : DynamicDataSourceHolder.getSlaveDSMap().keySet()) {
        DynamicDataSourceHolder.getSlaveDSKeys().add(key);
    }

    // 創建DynamicDataSource
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClass(DynamicDataSource.class);
    beanDefinition.setSynthetic(true);

    MutablePropertyValues mpv = beanDefinition.getPropertyValues();
    mpv.addPropertyValue("defaultTargetDataSource", DynamicDataSourceHolder.getMasterDS());
    mpv.addPropertyValue("targetDataSources", targetDataSources);

    registry.registerBeanDefinition("dataSource", beanDefinition);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("<<<動態數據源注冊結束");
    }
}
 
開發者ID:lupindong,項目名稱:xq_seckill_microservice,代碼行數:36,代碼來源:DynamicDataSourceRegister.java

示例6: registerDynamicDataSourceBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
 * @Title: registerDynamicDataSourceBeanDefinition
 * @Description: 注冊動態數據源
 * @author Kola 6089555
 * @date 2017年4月26日 下午1:26:55
 * @param registry
 */
private void registerDynamicDataSourceBeanDefinition(BeanDefinitionRegistry registry) {
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClass(DynamicDataSource.class);
    beanDefinition.setSynthetic(true);
    beanDefinition.setPrimary(true);
    MutablePropertyValues mpv = beanDefinition.getPropertyValues();
    mpv.addPropertyValue("defaultTargetDataSource", defaultDataSource);
    mpv.addPropertyValue("targetDataSources", targetDataSources);
    registry.registerBeanDefinition("dataSource", beanDefinition);
    LOGGER.info("Dynamic DataSource Registry");
}
 
開發者ID:6089555,項目名稱:spring-boot-starter-dynamic-datasource,代碼行數:19,代碼來源:DynamicDataSourceRegister.java

示例7: initializeForConsumer

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
public void initializeForConsumer(ConfigurableListableBeanFactory beanFactory, String application, String targetBeanName)
		throws BeansException {
	BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;

	// <dubbo:reference id="yyy"
	// interface="org.bytesoft.bytejta.supports.wire.RemoteCoordinator" group="org-bytesoft-bytetcc"
	// timeout="3000" filter="compensable" loadbalance="compensable" cluster="failfast" />
	GenericBeanDefinition beanDef = new GenericBeanDefinition();
	beanDef.setBeanClass(com.alibaba.dubbo.config.spring.ReferenceBean.class);

	MutablePropertyValues mpv = beanDef.getPropertyValues();
	mpv.addPropertyValue("interface", RemoteCoordinator.class.getName());
	mpv.addPropertyValue("timeout", "6000");
	mpv.addPropertyValue("cluster", "failfast");
	mpv.addPropertyValue("loadbalance", "compensable");
	mpv.addPropertyValue("filter", "compensable");
	mpv.addPropertyValue("group", "org-bytesoft-bytetcc");
	mpv.addPropertyValue("check", "false");
	mpv.addPropertyValue("retries", "0");

	String stubBeanId = String.format("[email protected]%s", RemoteCoordinator.class.getName());
	registry.registerBeanDefinition(stubBeanId, beanDef);

	// <bean class="org.bytesoft.bytetcc.supports.dubbo.CompensableBeanRegistry"
	// factory-method="getInstance">
	// <property name="consumeCoordinator" ref="yyy" />
	// </bean>
	BeanDefinition targetBeanDef = beanFactory.getBeanDefinition(targetBeanName);
	MutablePropertyValues targetMpv = targetBeanDef.getPropertyValues();
	targetMpv.addPropertyValue("consumeCoordinator", new RuntimeBeanReference(stubBeanId));
}
 
開發者ID:liuyangming,項目名稱:ByteTCC,代碼行數:32,代碼來源:CompensableConfigPostProcessor.java

示例8: initializeForConsumer

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
public void initializeForConsumer(ConfigurableListableBeanFactory beanFactory, String application, String targetBeanName)
		throws BeansException {
	BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;

	// <dubbo:reference id="yyy"
	// interface="org.bytesoft.bytejta.supports.wire.RemoteCoordinator"
	// timeout="6000" group="org.bytesoft.bytejta" loadbalance="transaction" cluster="failfast" />
	GenericBeanDefinition beanDef = new GenericBeanDefinition();
	beanDef.setBeanClass(com.alibaba.dubbo.config.spring.ReferenceBean.class);

	MutablePropertyValues mpv = beanDef.getPropertyValues();
	mpv.addPropertyValue("interface", RemoteCoordinator.class.getName());
	mpv.addPropertyValue("timeout", "6000");
	mpv.addPropertyValue("cluster", "failfast");
	mpv.addPropertyValue("loadbalance", "transaction");
	mpv.addPropertyValue("filter", "transaction");
	mpv.addPropertyValue("group", "org.bytesoft.bytejta");
	mpv.addPropertyValue("check", "false");

	String stubBeanId = String.format("[email protected]%s", RemoteCoordinator.class.getName());
	registry.registerBeanDefinition(stubBeanId, beanDef);

	// <bean id="xxx" class="org.bytesoft.bytejta.supports.dubbo.TransactionBeanRegistry"
	// factory-method="getInstance">
	// <property name="consumeCoordinator" ref="yyy" />
	// </bean>
	BeanDefinition targetBeanDef = beanFactory.getBeanDefinition(targetBeanName);
	MutablePropertyValues targetMpv = targetBeanDef.getPropertyValues();
	targetMpv.addPropertyValue("consumeCoordinator", new RuntimeBeanReference(stubBeanId));
}
 
開發者ID:liuyangming,項目名稱:ByteJTA,代碼行數:31,代碼來源:TransactionConfigPostProcessor.java


注:本文中的org.springframework.beans.factory.support.GenericBeanDefinition.getPropertyValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。