本文整理匯總了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());
}
}
}
示例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;
}
示例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);
}
示例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 );
}
示例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" );
}
示例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 );
}
示例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;
}
示例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);
}
示例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 );
}
示例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