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


Java ApplicationContext.getAutowireCapableBeanFactory方法代碼示例

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


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

示例1: registerSingleton

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
public static void registerSingleton(ApplicationContext applicationContext, String beanName, Object singletonObject) {

    AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory();
    if (!SingletonBeanRegistry.class.isAssignableFrom(beanFactory.getClass())) {
      throw new IllegalArgumentException(
          "ApplicationContext: " + applicationContext.getClass().toString()
              + " doesn't implements SingletonBeanRegistry, cannot register JMS connection at runtime");
    }

    SingletonBeanRegistry beanDefinitionRegistry = (SingletonBeanRegistry) beanFactory;
    beanDefinitionRegistry.registerSingleton(beanName, singletonObject);

  }
 
開發者ID:bighector,項目名稱:-artemis-disruptor-miaosha,代碼行數:14,代碼來源:BeanRegisterUtils.java

示例2: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
@Autowired
public void setApplicationContext(ApplicationContext ctx) {
    if (!DefaultListableBeanFactory.class.isAssignableFrom(ctx.getAutowireCapableBeanFactory().getClass())) {
        throw new IllegalArgumentException("BeanFactory must be DefaultListableBeanFactory type");
    }
    this.ctx = ctx;
    this.beanFactory = (DefaultListableBeanFactory) ctx.getAutowireCapableBeanFactory();
}
 
開發者ID:cattientk,項目名稱:daros-dynamic,代碼行數:9,代碼來源:DynamicRegisterGroovyFile.java

示例3: init

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
public void init() {
    if (log.isDebugEnabled()) log.debug("kaltura EP.init()");
    try {
        entityManager.registerEntityProducer(this, REFERENCE_ROOT);
        log.info("Registered kaltura entity producer as: "+ REFERENCE_ROOT);

        // AZ - now we need to do some serious spring gymnastics to get our service into the main Sakai AC
        // get the main sakai AC (it will be the parent of our AC)
        ApplicationContext sakaiAC = applicationContext.getParent();
        if (sakaiAC != null && sakaiAC instanceof ConfigurableApplicationContext) {
            // only ConfigurableApplicationContext - or higher - can register singletons
            Object currentKEP = ComponentManager.get(KalturaEntityProducer.class.getName());
            // check if something is already registered
            if (currentKEP != null) {
                log.info("Found existing "+KalturaEntityProducer.class.getName()+" in the ComponentManager: "+currentKEP);
                // attempt to unregister the existing bean (otherwise the register call will fail)
                try {
                    // only DefaultListableBeanFactory - or higher - can unregister singletons
                    DefaultListableBeanFactory dlbf = (DefaultListableBeanFactory) sakaiAC.getAutowireCapableBeanFactory();
                    dlbf.destroySingleton(KalturaEntityProducer.class.getName());
                    log.info("Removed existing "+KalturaEntityProducer.class.getName()+" from the ComponentManager");
                } catch (Exception e) {
                    log.warn("FAILED attempted removal of kaltura bean: "+e);
                }
            }
            // register this EP with the sakai AC
            ((ConfigurableApplicationContext)sakaiAC).getBeanFactory().registerSingleton(KalturaEntityProducer.class.getName(), this);
        }
        // now verify if we are good to go
        if (ComponentManager.get(KalturaEntityProducer.class.getName()) != null) {
            log.info("Found "+KalturaEntityProducer.class.getName()+" in the ComponentManager");
        } else {
            log.warn("FAILED to insert and lookup "+KalturaEntityProducer.class.getName()+" in the Sakai ComponentManager, archive imports for kaltura will not work");
        }
    } catch (Exception ex) {
        log.warn("kaltura EP.init(): "+ex, ex);
    }
}
 
開發者ID:ITYug,項目名稱:kaltura-ce-sakai-extension,代碼行數:39,代碼來源:KalturaEntityProducer.java

示例4: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
	this.context = context;
	AutowireCapableBeanFactory beanFactory = context.getAutowireCapableBeanFactory();
	checkState(ConfigurableListableBeanFactory.class.isInstance(beanFactory),
		"Martini requires the use of a ConfigurableListableBeanFactory");
	ConfigurableListableBeanFactory configurable = ConfigurableListableBeanFactory.class.cast(beanFactory);
	callbacks = ImmutableList.<ReflectionUtils.MethodCallback>builder()
		.add(new MartiniAnnotationCallback<>(Given.class, GivenContainer.class, configurable))
		.add(new MartiniAnnotationCallback<>(And.class, AndContainer.class, configurable))
		.add(new MartiniAnnotationCallback<>(When.class, WhenContainer.class, configurable))
		.add(new MartiniAnnotationCallback<>(Then.class, ThenContainer.class, configurable))
		.build();
}
 
開發者ID:qas-guru,項目名稱:martini-core,代碼行數:15,代碼來源:StepsAnnotationProcessor.java

示例5: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
@Override
public void setApplicationContext(final ApplicationContext context) {
    beanFactory = context.getAutowireCapableBeanFactory();
}
 
開發者ID:javabypatel,項目名稱:spring-boot-quartz-demo,代碼行數:5,代碼來源:AutowiringSpringBeanJobFactory.java

示例6: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
@Override
public void setApplicationContext (final ApplicationContext context)
{
   beanFactory = context.getAutowireCapableBeanFactory ();
}
 
開發者ID:SentinelDataHub,項目名稱:dhus-core,代碼行數:6,代碼來源:AutowiringJobFactory.java

示例7: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
	beanFactory = applicationContext.getAutowireCapableBeanFactory();
}
 
開發者ID:juliuskrah,項目名稱:quartz-manager,代碼行數:5,代碼來源:AutowiringSpringBeanJobFactory.java

示例8: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
public void setApplicationContext(final ApplicationContext context) {
    beanFactory = context.getAutowireCapableBeanFactory();
}
 
開發者ID:farchanjo,項目名稱:webcron,代碼行數:4,代碼來源:AutowiringSpringBeanJobFactory.java

示例9: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
public void setApplicationContext(final ApplicationContext context) {
	beanFactory = context.getAutowireCapableBeanFactory();
}
 
開發者ID:wjggwm,項目名稱:webside,代碼行數:4,代碼來源:AutowiringSpringBeanJobFactory.java

示例10: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    autowireCapableBeanFactory = applicationContext.getAutowireCapableBeanFactory();
}
 
開發者ID:taboola,項目名稱:taboola-cronyx,代碼行數:5,代碼來源:DelegatingQuartzJobFactory.java

示例11: registerBeans

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
private void registerBeans(ApplicationContext applicationContext) throws BeansException {
    DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory) applicationContext.getAutowireCapableBeanFactory();
    BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(getUserRepositoryProxy().getClass());
    defaultListableBeanFactory.registerBeanDefinition("userRepository", beanDefinitionBuilder.getBeanDefinition());
}
 
開發者ID:MinsxCloud,項目名稱:minsx-java-example,代碼行數:6,代碼來源:AppConfig.java

示例12: BeanDefinitionFinder

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
public BeanDefinitionFinder(ApplicationContext applicationContext, DoubleRegistry doubleRegistry) {
	this(
			(ConfigurableListableBeanFactory) applicationContext.getAutowireCapableBeanFactory(),
			doubleRegistry);
}
 
開發者ID:pchudzik,項目名稱:springmock,代碼行數:6,代碼來源:BeanDefinitionFinder.java

示例13: handlerInstantiator

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
/**
 * Needed for injection into jackson deserilizer.
 *
 * @param context
 * @return
 */
@Bean
public HandlerInstantiator handlerInstantiator(ApplicationContext context) {
    return new SpringHandlerInstantiator(context.getAutowireCapableBeanFactory());
}
 
開發者ID:Taskana,項目名稱:taskana,代碼行數:11,代碼來源:RestApplication.java

示例14: setApplicationContext

import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
/**
 * Constructor that takes an auto wire capable bean spring bean factory.
 * @param context
 * 				auto wire capable bean spring bean factory
 */
@Override
public void setApplicationContext(final ApplicationContext context) {
	beanFactory = context.getAutowireCapableBeanFactory();
}
 
開發者ID:andrehertwig,項目名稱:spring-boot-starter-quartz,代碼行數:10,代碼來源:AutowiringSpringBeanJobFactory.java


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