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


Java GenericBeanDefinition.setBeanClassName方法代码示例

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


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

示例1: createBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
private static BeanDefinition createBeanDefinition(ComponentDefinition componentDefinition) {
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();

    beanDefinition.setBeanClassName(componentDefinition.getComponentClass());
    beanDefinition.setScope(getScope(componentDefinition.getScope()));
    beanDefinition.setAutowireCandidate(true);
    beanDefinition.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
    beanDefinition.setDependsOn(componentDefinition.getDependsOn());
    beanDefinition.setLazyInit(componentDefinition.isLazyInit());

    ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues();
    for (Object value : componentDefinition.getConstructorArguments()) {
        constructorArgumentValues.addIndexedArgumentValue(constructorArgumentValues.getArgumentCount(), value);
    }
    beanDefinition.setConstructorArgumentValues(constructorArgumentValues);

    MutablePropertyValues propertyValues = new MutablePropertyValues();
    for (PropertyValue propertyValue : componentDefinition.getPropertyValues()) {
        propertyValues.add(propertyValue.getName(), propertyValue.getValue());
    }
    beanDefinition.setPropertyValues(propertyValues);

    return beanDefinition;
}
 
开发者ID:Indoqa,项目名称:indoqa-spring,代码行数:25,代码来源:DynamicApplicationContextBuilder.java

示例2: toInternal

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
/**
 * Convert from a DTO to an internal Spring bean definition.
 * 
 * @param beanDefinitionDto The DTO object.
 * @return Returns a Spring bean definition.
 */
public BeanDefinition toInternal(BeanDefinitionInfo beanDefinitionInfo) {
	if (beanDefinitionInfo instanceof GenericBeanDefinitionInfo) {
		GenericBeanDefinitionInfo genericInfo = (GenericBeanDefinitionInfo) beanDefinitionInfo;
		GenericBeanDefinition def = new GenericBeanDefinition();
		def.setBeanClassName(genericInfo.getClassName());
		if (genericInfo.getPropertyValues() != null) {
			MutablePropertyValues propertyValues = new MutablePropertyValues();
			for (Entry<String, BeanMetadataElementInfo> entry : genericInfo.getPropertyValues().entrySet()) {
				BeanMetadataElementInfo info = entry.getValue();
				propertyValues.add(entry.getKey(), toInternal(info));
			}
			def.setPropertyValues(propertyValues);
		}
		return def;
	} else if (beanDefinitionInfo instanceof ObjectBeanDefinitionInfo) {
		ObjectBeanDefinitionInfo objectInfo = (ObjectBeanDefinitionInfo) beanDefinitionInfo;
		return createBeanDefinitionByIntrospection(objectInfo.getObject());
	} else {
		throw new IllegalArgumentException("Conversion to internal of " + beanDefinitionInfo.getClass().getName()
				+ " not implemented");
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:29,代码来源:BeanDefinitionDtoConverterServiceImpl.java

示例3: createBeans

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<BeanDefinitionHolder> createBeans(Map<String, Object> parameters) throws RuntimeConfigException {
	GenericBeanDefinition def = new GenericBeanDefinition();
	def.setBeanClassName(className);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	List<NamedObject> namedObjects = new ArrayList<NamedObject>();
	if (checkCollection(BEAN_REFS, NamedObject.class, parameters) != Priority.NONE) {
		namedObjects.addAll((Collection) parameters.get(BEAN_REFS));
	}
	for (String name : parameters.keySet()) {
		if (!ignoredParams.contains(name)) {
			propertyValues.addPropertyValue(name, beanDefinitionDtoConverterService
					.createBeanMetadataElementByIntrospection(parameters.get(name), namedObjects));
		}
	}
	def.setPropertyValues(propertyValues);
	BeanDefinitionHolder holder = new BeanDefinitionHolder(def, (String) parameters.get(BEAN_NAME));
	List<BeanDefinitionHolder> holders = new ArrayList<BeanDefinitionHolder>();
	holders.add(holder);
	return holders;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:22,代码来源:BaseBeanFactory.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) {
	GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setBeanClassName(String.class.getName());
	registry.registerBeanDefinition("registrarImportedBean", beanDefinition);
	GenericBeanDefinition beanDefinition2 = new GenericBeanDefinition();
	beanDefinition2.setBeanClass(OtherImportedConfig.class);
	registry.registerBeanDefinition("registrarImportedConfig", beanDefinition2);
	Assert.state(!called, "ImportedRegistrar called twice");
	called = true;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:ImportAwareTests.java

示例6: registerBean

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
/**
 * Add's a new bean to Spring's context
 *
 * @param name
 */
public void registerBean(final String name) {
    if (registeredbeans.containsKey(name)) {
        return;
    }
    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClassName(name);
    beanDefinition.setAutowireCandidate(true);
    AutowireCapableBeanFactory factory = applicationContext.getAutowireCapableBeanFactory();
    BeanDefinitionRegistry registry = (BeanDefinitionRegistry) factory;
    registry.registerBeanDefinition(name, beanDefinition);
    factory.autowireBeanProperties(this,
            AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
    registeredbeans.put(name, Boolean.TRUE);
}
 
开发者ID:rvt,项目名称:cnctools,代码行数:20,代码来源:ScreensConfiguration.java

示例7: createAndRegisterScriptBeanFactoryBean

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
private void createAndRegisterScriptBeanFactoryBean(BeanDefinitionRegistry registry,
		String beanName, String location) {
	GenericBeanDefinition scriptBd = new GenericBeanDefinition();
	scriptBd.setBeanClassName(DEFAULT_SCRIPT_FACTORY_CLASS_NAME);
	ConstructorArgumentValues cav = scriptBd.getConstructorArgumentValues();
	int constructorArgNum = 0;
	cav.addIndexedArgumentValue(constructorArgNum++, location);
	
	scriptBd.getConstructorArgumentValues().addArgumentValues(cav);
	registry.registerBeanDefinition(DEFAULT_SCRIPT_FACTORY_NAME + beanName,scriptBd);
}
 
开发者ID:valliappanr,项目名称:refreshable-beans,代码行数:12,代码来源:SpringContextWrapper.java

示例8: createScriptFactoryBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
/**
 * Create a ScriptFactory bean definition based on the given script definition,
 * extracting only the definition data that is relevant for the ScriptFactory
 * (that is, only bean class and constructor arguments).
 * @param bd the full script bean definition
 * @return the extracted ScriptFactory bean definition
 * @see org.springframework.scripting.ScriptFactory
 */
protected BeanDefinition createScriptFactoryBeanDefinition(BeanDefinition bd) {
	GenericBeanDefinition scriptBd = new GenericBeanDefinition();
	scriptBd.setBeanClassName(bd.getBeanClassName());
	scriptBd.getConstructorArgumentValues().addArgumentValues(bd.getConstructorArgumentValues());
	return scriptBd;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:ScriptFactoryPostProcessor.java

示例9: createScriptFactoryBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
/**
    * Create a ScriptFactory bean definition based on the given script
    * definition, extracting only the definition data that is relevant for the
    * ScriptFactory (that is, only bean class and constructor arguments).
    * 
    * @param bd
    *            the full script bean definition
    * @return the extracted ScriptFactory bean definition
    * @see org.springframework.scripting.ScriptFactory
    */
   protected BeanDefinition createScriptFactoryBeanDefinition(BeanDefinition bd) {
GenericBeanDefinition scriptBd = new GenericBeanDefinition();
scriptBd.setBeanClassName(bd.getBeanClassName());
scriptBd.getConstructorArgumentValues().addArgumentValues(bd.getConstructorArgumentValues());
return scriptBd;
   }
 
开发者ID:ilivoo,项目名称:game,代码行数:17,代码来源:MyScriptFactoryPostProcessor.java


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