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


Java GenericBeanDefinition.setFactoryBeanName方法代码示例

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


在下文中一共展示了GenericBeanDefinition.setFactoryBeanName方法的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.setFactoryBeanName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。