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


Java GenericBeanDefinition.setLazyInit方法代碼示例

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


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

示例3: registerAspect

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
 * register aspectJ for disconf get request
 *
 * @param registry
 */
private void registerAspect(BeanDefinitionRegistry registry) {

    GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
    beanDefinition.setBeanClass(DisconfAspectJ.class);
    beanDefinition.setLazyInit(false);
    beanDefinition.setAbstract(false);
    beanDefinition.setAutowireCandidate(true);
    beanDefinition.setScope("singleton");

    registry.registerBeanDefinition("disconfAspectJ", beanDefinition);
}
 
開發者ID:ningyu1,項目名稱:disconf-client-ext,代碼行數:17,代碼來源:DisconfMgrBeanExt.java

示例4: testNonSingletonSteps

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
@Test(expectedExceptions = FatalBeanException.class)
public void testNonSingletonSteps() {
	ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("emptyContext.xml");
	ConfigurableListableBeanFactory factory = context.getBeanFactory();

	GenericBeanDefinition definition = new GenericBeanDefinition();
	definition.setBeanClass(DuplicateGivenBeanA.class);
	definition.setLazyInit(false);
	definition.setScope("prototype");

	BeanDefinitionRegistry registry = BeanDefinitionRegistry.class.cast(factory);
	registry.registerBeanDefinition(DuplicateGivenBeanA.class.getName(), definition);
	process(context, new DuplicateGivenBeanA());
}
 
開發者ID:qas-guru,項目名稱:martini-core,代碼行數:15,代碼來源:StepsAnnotationProcessorTest.java

示例5: registerBean

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
/**
 * Register bean.
 *
 * @param beanToRegister the bean to register
 * @param beanName the bean name
 * @param scope the scope
 * @param setLazyInit the set lazy init
 * @param setAutowireCandidate the set autowire candidate
 */
public void registerBean(Class<?> beanToRegister, String beanName,
		String scope /* "session" */, boolean setLazyInit,
		boolean setAutowireCandidate) {
	GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setBeanClass(beanToRegister);
	beanDefinition.setLazyInit(setLazyInit);
	beanDefinition.setAbstract(false);
	beanDefinition.setAutowireCandidate(setAutowireCandidate);
	beanDefinition.setScope(scope);

	registry.registerBeanDefinition(beanName, beanDefinition);
}
 
開發者ID:techtrip,項目名稱:dynamicbeanloader,代碼行數:22,代碼來源:ContextAwareBeanFactory.java

示例6: registerBean

import org.springframework.beans.factory.support.GenericBeanDefinition; //導入方法依賴的package包/類
public void registerBean(Class<?> beanClass, String name) {
  GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
  beanDefinition.setBeanClass(beanClass);
  beanDefinition.setLazyInit(false);
  beanDefinition.setAbstract(false);
  applicationContext.registerBeanDefinition(name, beanDefinition);
}
 
開發者ID:orctom,項目名稱:laputa,代碼行數:8,代碼來源:LaputaService.java


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