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


Java BeanDefinitionBuilder.genericBeanDefinition方法代码示例

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


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

示例1: registerBeanDefinitions

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
	AnnotationAttributes enableMenu = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(EnableMenu.class
																											.getName(),
																									false));

	if (enableMenu != null) {
		BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DefaultMenuPlugin.class);
		AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();

		MutablePropertyValues mutablePropertyValues = new MutablePropertyValues();
		mutablePropertyValues.add("extensionPointId", enableMenu.getString("extensionPointId"));
		mutablePropertyValues.add("pluginId", enableMenu.getString("pluginId"));
		mutablePropertyValues.add("menu", toMenu(enableMenu.getAnnotationArray("menu")));
		beanDefinition.setPropertyValues(mutablePropertyValues);

		registry.registerBeanDefinition("menuPlugin:" + enableMenu.getString("pluginId"), beanDefinition);
	}
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:20,代码来源:EnableMenuImportSelector.java

示例2: instantiateComponent

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
public static <T> T instantiateComponent(DefaultListableBeanFactory beanFactory, Class<T> cls, Annotation annotation) {
    T extractor;

    try {
        extractor = beanFactory.getBean(cls);
    } catch (BeansException e) {
        try {
            extractor = (T) beanFactory.getBean(cls.getName());
        } catch (BeansException e1) {
            BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(cls.getName());
            beanFactory.registerBeanDefinition(cls.getName(), beanDefinition.getBeanDefinition());
            extractor = (T) beanFactory.getBean(cls.getName());
        }
    }
    return extractor;
}
 
开发者ID:onepiecex,项目名称:mq-aliyun,代码行数:17,代码来源:ArgumentExtractors.java

示例3: registerBean

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
/**
 * 动态注册一个Bean动Spring容器中
 *
 * @param beanName  名称
 * @param beanClazz 定义bean
 */
public void registerBean(String beanName, Class beanClazz, Map<String, Object> propertys) {
    Assert.notNull(beanName);
    Assert.notNull(beanClazz);
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(beanClazz);
    if (propertys != null) {
        propertys.forEach((k, v) -> builder.addPropertyValue(k, v));
    }
    builder.setScope(BeanDefinition.SCOPE_SINGLETON);
    registerBean(beanName, builder.getBeanDefinition());

}
 
开发者ID:yu199195,项目名称:happylifeplat-transaction,代码行数:18,代码来源:SpringBeanUtils.java

示例4: registerBeanDefinitions

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
    MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(EnableMessageSource.class.getName(), false);
    boolean fallbackToSystemLocale = (boolean) (attributes != null ? attributes.getFirst("fallbackToSystemLocale") : false);
    String[] basenames = (String[]) (attributes != null ? attributes.getFirst("basenames") : null);

    BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition(ConfigMessageSourceConfigurer.class);
    bean.addPropertyValue("fallbackToSystemLocale", fallbackToSystemLocale);
    if (basenames != null && basenames.length > 0) {
        bean.addPropertyValue("basenames", basenames);
    }
    registry.registerBeanDefinition(ConfigMessageSourceConfigurer.class.getName(), bean.getBeanDefinition());
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:14,代码来源:EnableMessageSourceImportSelector.java

示例5: registerConfigBeanPropertyResolver

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
/**
 * 注册ConfigBeanPropertyResolver
 *
 * @param registry
 */
public static void registerConfigBeanPropertyResolver(BeanDefinitionRegistry registry) {
    if (!registry.containsBeanDefinition(CONFIG_BEAN_PROPERTY_RESOLVER_BEAN_NAME)) {
        BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition(ConfigPropertyResolver.class);
        registry.registerBeanDefinition(CONFIG_BEAN_PROPERTY_RESOLVER_BEAN_NAME, bean.getBeanDefinition());
    }
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:12,代码来源:ConfigBeanConfigUtils.java

示例6: 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

示例7: triggerTaskReference

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

示例8: registerConverters

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private void registerConverters(BeanDefinitionRegistry registry, List<Class<?>> types) {

            // Register ConfigConverter by CustomConverterConfigurer
            String name = ConfigBeanConverterConfigurer.class.getName() + "." + EnableConfigService.class.getSimpleName();
            // converters
            List<ConfigBeanConverter> converters = instantiateConverters(types);

            BeanDefinitionBuilder builder = BeanDefinitionBuilder
                    .genericBeanDefinition(ConfigBeanConverterConfigurer.class);
            builder.addPropertyValue("converters", converters);
            AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();

            registry.registerBeanDefinition(name, beanDefinition);
        }
 
开发者ID:zouzhirong,项目名称:configx,代码行数:15,代码来源:EnableConfigServiceImportSelector.java

示例9: createScannerConfigurerBean

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
protected final AbstractBeanDefinition createScannerConfigurerBean(String sqlSessionFactoryName, String basepackage,
		Mapper mappers, Order order,Style style) {
	BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(MapperScannerConfigurer.class);
	Properties properties = new Properties();
	if(style!=null){
		properties.setProperty("style", style.name());
	}
	properties.setProperty("notEmpty", "true");
	properties.setProperty("ORDER", order != null ? order.order : Order.BEFORE.order);
	properties.setProperty("mappers", mappers != null ? mappers.mapper : Mapper.DEFAULT.mapper);
	bdb.addPropertyValue("properties", properties);
	bdb.addPropertyValue("sqlSessionFactoryBeanName", sqlSessionFactoryName);
	bdb.addPropertyValue("basePackage", basepackage);
	return bdb.getRawBeanDefinition();
}
 
开发者ID:halober,项目名称:spring-boot-starter-dao,代码行数:16,代码来源:AbstractDataBaseBean.java

示例10: createBeanDefinitionBuilder

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
public BeanDefinitionBuilder createBeanDefinitionBuilder(Element element, ParserContext parserContext, Class<?> cls) {
    BeanDefinitionBuilder builder
            = BeanDefinitionBuilder.genericBeanDefinition();
    builder.getRawBeanDefinition().setBeanClass(cls);
    builder.getRawBeanDefinition()
            .setSource(parserContext.extractSource(element));
    if (parserContext.isNested()) {
        builder.setScope(parserContext.getContainingBeanDefinition()
                .getScope());
    }
    if (parserContext.isDefaultLazyInit()) {
        builder.setLazyInit(true);
    }
    return builder;
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:16,代码来源:RedissonNamespaceParserSupport.java

示例11: registerLepService

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
private void registerLepService(BeanDefinitionRegistry registry,
                                AnnotationMetadata annotationMetadata,
                                Map<String, Object> attributes) {
    // has a default, won't be null
    boolean primary = (Boolean) attributes.get("primary");

    String className = annotationMetadata.getClassName();
    BeanDefinitionBuilder definition = BeanDefinitionBuilder
        .genericBeanDefinition(LepServiceFactoryBean.class);
    definition.addPropertyValue("type", className);
    definition.addPropertyValue("annotationMetadata", annotationMetadata);
    definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);

    AbstractBeanDefinition beanDefinition = definition.getBeanDefinition();
    beanDefinition.setPrimary(primary);

    String name = getBeanName(annotationMetadata, attributes);
    String alias = name + LepService.class.getSimpleName();
    String qualifier = getQualifier(attributes);
    if (StringUtils.hasText(qualifier)) {
        alias = qualifier;
    }

    BeanDefinitionHolder holder = new BeanDefinitionHolder(beanDefinition, name,
                                                           new String[] {alias});
    BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry);
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:28,代码来源:LepServicesRegistrar.java

示例12: 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

示例13: 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

示例14: registerBeanDefinitions

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition(ConfigJmxBeanDefinitionRegistryPostProcessor.class);
    registry.registerBeanDefinition(ConfigJmxBeanDefinitionRegistryPostProcessor.class.getName(), bean.getBeanDefinition());
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:6,代码来源:EnableConfigJmxImportSelector.java

示例15: registerBeanDefinitions

import org.springframework.beans.factory.support.BeanDefinitionBuilder; //导入方法依赖的package包/类
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
    BeanDefinitionBuilder bean = BeanDefinitionBuilder.genericBeanDefinition(ConfigBeanDefinitionRegistryPostProcessor.class);
    registry.registerBeanDefinition(ConfigBeanDefinitionRegistryPostProcessor.class.getName(), bean.getBeanDefinition());
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:6,代码来源:EnableConfigServiceImportSelector.java


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