當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。