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


Java GenericBeanDefinition.setFactoryMethodName方法代碼示例

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


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

示例1: createApplicationServlet

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
 * Creates a Servlet bean definition for the given JAX-RS application
 *
 * @param applicationClass
 * @param path
 * @return a Servlet bean definition for the given JAX-RS application
 */
private GenericBeanDefinition createApplicationServlet(Class<? extends Application> applicationClass, String path) {
    GenericBeanDefinition applicationServletBean = new GenericBeanDefinition();
    applicationServletBean.setFactoryBeanName(ResteasyApplicationBuilder.BEAN_NAME);
    applicationServletBean.setFactoryMethodName("build");

    Set<Class<?>> resources = allResources;

    ConstructorArgumentValues values = new ConstructorArgumentValues();
    values.addIndexedArgumentValue(0, applicationClass.getName());
    values.addIndexedArgumentValue(1, path);
    values.addIndexedArgumentValue(2, resources);
    values.addIndexedArgumentValue(3, providers);
    applicationServletBean.setConstructorArgumentValues(values);

    applicationServletBean.setAutowireCandidate(false);
    applicationServletBean.setScope("singleton");

    return applicationServletBean;
}
 
開發者ID:paypal,項目名稱:resteasy-spring-boot,代碼行數:27,代碼來源:ResteasyEmbeddedServletInitializer.java

示例2: createBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
private BeanDefinition createBeanDefinition(Object settings, Object setting, String factoryBeanName, Method factoryMethod) {
    final GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setFactoryBeanName(factoryBeanName);
    definition.setFactoryMethodName(factoryMethod.getName());
    
    //Create method arguments (confusingly called constructor arguments in spring)
    final ConstructorArgumentValues arguments = new ConstructorArgumentValues();
    arguments.addIndexedArgumentValue(0, setting);
    
    final int parameterCount = factoryMethod.getParameterTypes().length;
    if (parameterCount == 2) {
        arguments.addIndexedArgumentValue(1, settings);
    } else if (parameterCount > 2) {
        throw getExceptionFactory().createInvalidArgumentsException(factoryMethod);
    }
    
    //TODO more checking of method arguments to ensure they're correct
    
    definition.setConstructorArgumentValues(arguments);

    return definition;
}
 
開發者ID:Capgemini,項目名稱:spring-boot-capgemini,代碼行數:23,代碼來源:SettingBackedBeanFactoryPostProcessor.java

示例3: createAndRegisterBean

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
private void createAndRegisterBean(BeanDefinitionRegistry registry,
		String beanName,  Class<?>[] interfaces, ResourceScriptSource rs,
		long refreshCheckDelay) {
	GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setFactoryBeanName(DEFAULT_SCRIPT_FACTORY_NAME + beanName);
	beanDefinition.setFactoryMethodName(DEFAULT_SCRIPT_FACTORY_METHOD_NAME);
	beanDefinition.getConstructorArgumentValues().clear();
	beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(0, rs);
	beanDefinition.getConstructorArgumentValues().addIndexedArgumentValue(1, interfaces);
	beanDefinition.setAutowireCandidate(true);
	beanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE);
	beanDefinition.setAttribute(
			ScriptFactoryPostProcessor.REFRESH_CHECK_DELAY_ATTRIBUTE, refreshCheckDelay);		
    registry.registerBeanDefinition(beanName,beanDefinition);		

}
 
開發者ID:valliappanr,項目名稱:refreshable-beans,代碼行數:17,代碼來源:SpringContextWrapper.java

示例4: createScriptedObjectBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
 * Create a bean definition for the scripted object, based on the given script
 * definition, extracting the definition data that is relevant for the scripted
 * object (that is, everything but bean class and constructor arguments).
 * @param bd the full script bean definition
 * @param scriptFactoryBeanName the name of the internal ScriptFactory bean
 * @param scriptSource the ScriptSource for the scripted bean
 * @param interfaces the interfaces that the scripted bean is supposed to implement
 * @return the extracted ScriptFactory bean definition
 * @see org.springframework.scripting.ScriptFactory#getScriptedObject
 */
protected BeanDefinition createScriptedObjectBeanDefinition(BeanDefinition bd, String scriptFactoryBeanName,
		ScriptSource scriptSource, Class<?>[] interfaces) {

	GenericBeanDefinition objectBd = new GenericBeanDefinition(bd);
	objectBd.setFactoryBeanName(scriptFactoryBeanName);
	objectBd.setFactoryMethodName("getScriptedObject");
	objectBd.getConstructorArgumentValues().clear();
	objectBd.getConstructorArgumentValues().addIndexedArgumentValue(0, scriptSource);
	objectBd.getConstructorArgumentValues().addIndexedArgumentValue(1, interfaces);
	return objectBd;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:ScriptFactoryPostProcessor.java

示例5: createScriptedObjectBeanDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
    * Create a bean definition for the scripted object, based on the given
    * script definition, extracting the definition data that is relevant for
    * the scripted object (that is, everything but bean class and constructor
    * arguments).
    * 
    * @param bd
    *            the full script bean definition
    * @param scriptFactoryBeanName
    *            the name of the internal ScriptFactory bean
    * @param scriptSource
    *            the ScriptSource for the scripted bean
    * @param interfaces
    *            the interfaces that the scripted bean is supposed to implement
    * @return the extracted ScriptFactory bean definition
    * @see org.springframework.scripting.ScriptFactory#getScriptedObject
    */
   protected BeanDefinition createScriptedObjectBeanDefinition(BeanDefinition bd, String scriptFactoryBeanName,
    ScriptSource scriptSource, Class<?>[] interfaces) {

GenericBeanDefinition objectBd = new GenericBeanDefinition(bd);
objectBd.setFactoryBeanName(scriptFactoryBeanName);
objectBd.setFactoryMethodName("getScriptedObject");
objectBd.getConstructorArgumentValues().clear();
objectBd.getConstructorArgumentValues().addIndexedArgumentValue(0, scriptSource);
objectBd.getConstructorArgumentValues().addIndexedArgumentValue(1, interfaces);
return objectBd;
   }
 
開發者ID:ilivoo,項目名稱:game,代碼行數:29,代碼來源:MyScriptFactoryPostProcessor.java


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