本文整理汇总了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);
}
示例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();
}
示例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);
}
}
示例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();
}
示例5: setApplicationContext
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Override
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
}
示例6: setApplicationContext
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Override
public void setApplicationContext (final ApplicationContext context)
{
beanFactory = context.getAutowireCapableBeanFactory ();
}
示例7: setApplicationContext
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
beanFactory = applicationContext.getAutowireCapableBeanFactory();
}
示例8: setApplicationContext
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
}
示例9: setApplicationContext
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
}
示例10: setApplicationContext
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
autowireCapableBeanFactory = applicationContext.getAutowireCapableBeanFactory();
}
示例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());
}
示例12: BeanDefinitionFinder
import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public BeanDefinitionFinder(ApplicationContext applicationContext, DoubleRegistry doubleRegistry) {
this(
(ConfigurableListableBeanFactory) applicationContext.getAutowireCapableBeanFactory(),
doubleRegistry);
}
示例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());
}
示例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();
}