当前位置: 首页>>代码示例>>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;未经允许,请勿转载。