当前位置: 首页>>代码示例>>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;未经允许,请勿转载。