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


Java AutowireCapableBeanFactory.autowireBeanProperties方法代碼示例

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


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

示例1: autowireArguments

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
private void autowireArguments(Object service, Object[] args) {
    if (disableAutowiredArguments) {
        return;
    }
    if (args == null) {
        return;
    }
    if (shouldAutowire(service)) {
        for (Object arg : args) {
            if (arg == null) {
                continue;
            }
            AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory();
            beanFactory.autowireBeanProperties(arg, AutowireCapableBeanFactory.AUTOWIRE_NO, false);
            beanFactory.initializeBean(arg, arg.getClass().getName());
        }
    }
}
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:19,代碼來源:SpaceRemotingServiceExporter.java

示例2: autoWireBean

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
/**
 * @param bean the bean to be autowired
 * @param autoWiringFactory the autowiring factory
 *
 * @return bean
 */
public Object autoWireBean(Object bean, AutowireCapableBeanFactory autoWiringFactory) {
    if (autoWiringFactory != null) {
        autoWiringFactory.autowireBeanProperties(bean, autowireStrategy, false);
    }
    injectApplicationContext(bean);

    injectInternalBeans(bean);

    return bean;
}
 
開發者ID:txazo,項目名稱:struts2,代碼行數:17,代碼來源:SpringObjectFactory.java

示例3: injectDependencies

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
@Override
protected void injectDependencies(TestContext testContext) throws Exception {
    MergeClassPathXMLApplicationContext context = BaseTest.getContext();
    Object bean = testContext.getTestInstance();
    AutowireCapableBeanFactory beanFactory = context.getAutowireCapableBeanFactory();
    beanFactory.autowireBeanProperties(bean, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, true);
    beanFactory.initializeBean(bean, testContext.getTestClass().getName());
    testContext.removeAttribute(REINJECT_DEPENDENCIES_ATTRIBUTE);
}
 
開發者ID:passion1014,項目名稱:metaworks_framework,代碼行數:10,代碼來源:MergeDependencyInjectionTestExecutionListener.java

示例4: registerBean

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的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

示例5: startSpring

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
public void startSpring() {

        String[] locations = getApplicationContextLocations();
        ApplicationContext ac = new ClassPathXmlApplicationContext( locations );

        AutowireCapableBeanFactory acbf = ac.getAutowireCapableBeanFactory();
        acbf.autowireBeanProperties( this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false );
        acbf.initializeBean( this, "webSocketServer" );

        assertNotNull( emf );
        assertTrue( "EntityManagerFactory is instance of EntityManagerFactoryImpl",
                emf instanceof EntityManagerFactoryImpl );
    }
 
開發者ID:apache,項目名稱:usergrid,代碼行數:14,代碼來源:WebSocketServer.java

示例6: setup

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
@Before
public void setup() throws Exception {
    // assertNotNull(client);

    String maven_opts = System.getenv( "MAVEN_OPTS" );
    logger.info( "Maven options: " + maven_opts );

    String[] locations = { "usergrid-test-context.xml" };
    ac = new ClassPathXmlApplicationContext( locations );

    AutowireCapableBeanFactory acbf = ac.getAutowireCapableBeanFactory();
    acbf.autowireBeanProperties( this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false );
    acbf.initializeBean( this, "testClient" );
}
 
開發者ID:apache,項目名稱:usergrid,代碼行數:15,代碼來源:HazelcastTest.java

示例7: startSpring

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
public void startSpring() {

        String[] locations = getApplicationContextLocations();
        ApplicationContext ac = new ClassPathXmlApplicationContext( locations );

        AutowireCapableBeanFactory acbf = ac.getAutowireCapableBeanFactory();
        acbf.autowireBeanProperties( this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false );
        acbf.initializeBean( this, "mongoServer" );

        assertNotNull( emf );
        assertTrue( "EntityManagerFactory is instance of EntityManagerFactoryImpl",
                emf instanceof EntityManagerFactoryImpl );
    }
 
開發者ID:apache,項目名稱:usergrid,代碼行數:14,代碼來源:MongoServer.java

示例8: autoWireBean

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
public Object autoWireBean(Object bean, AutowireCapableBeanFactory autoWiringFactory) {
	autoWiringFactory = findAutoWiringBeanFactory(Tavern.getCurrentApplication(bean.getClass())
			.getApplicationContext());
	if (autoWiringFactory != null) {
		autoWiringFactory.autowireBeanProperties(bean, autowireStrategy, false);
	}
	if (bean instanceof ApplicationContextAware) {
		((ApplicationContextAware) bean).setApplicationContext(appContext);
	}

	injectInternalBeans(bean);

	return bean;
}
 
開發者ID:code4craft,項目名稱:tavern,代碼行數:15,代碼來源:TavernSpringObjectFactory.java

示例9: injectAndInitialize

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
public static <T> void injectAndInitialize(AutowireCapableBeanFactory acb, T bean, int autowireMode) {
	acb.autowireBeanProperties(bean, autowireMode, false);
	initializeBean(acb, bean, autowireMode);
}
 
開發者ID:wayshall,項目名稱:onetwo,代碼行數:5,代碼來源:SpringUtils.java

示例10: startSpring

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
public void startSpring() {

        String[] locations = { "toolsApplicationContext.xml" };
        ApplicationContext ac = new ClassPathXmlApplicationContext( locations );

        AutowireCapableBeanFactory acbf = ac.getAutowireCapableBeanFactory();
        acbf.autowireBeanProperties( this, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false );
        acbf.initializeBean( this, "testClient" );

        assertNotNull( emf );
        assertTrue( "EntityManagerFactory is instance of EntityManagerFactory",
                emf instanceof EntityManagerFactory );

        injector = ac.getBean( Injector.class );


    }
 
開發者ID:apache,項目名稱:usergrid,代碼行數:18,代碼來源:ToolBase.java

示例11: injectDependencies

import org.springframework.beans.factory.config.AutowireCapableBeanFactory; //導入方法依賴的package包/類
/**
 * Performs dependency injection and bean initialization for the supplied
 * {@link TestContext} as described in
 * {@link #prepareTestInstance(TestContext) prepareTestInstance()}.
 * <p>The {@link #REINJECT_DEPENDENCIES_ATTRIBUTE} will be subsequently removed
 * from the test context, regardless of its value.
 * @param testContext the test context for which dependency injection should
 * be performed (never {@code null})
 * @throws Exception allows any exception to propagate
 * @see #prepareTestInstance(TestContext)
 * @see #beforeTestMethod(TestContext)
 */
protected void injectDependencies(final TestContext testContext) throws Exception {
	Object bean = testContext.getTestInstance();
	AutowireCapableBeanFactory beanFactory = testContext.getApplicationContext().getAutowireCapableBeanFactory();
	beanFactory.autowireBeanProperties(bean, AutowireCapableBeanFactory.AUTOWIRE_NO, false);
	beanFactory.initializeBean(bean, testContext.getTestClass().getName());
	testContext.removeAttribute(REINJECT_DEPENDENCIES_ATTRIBUTE);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:20,代碼來源:DependencyInjectionTestExecutionListener.java


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