/** * Instantiate and invoke all registered BeanFactoryPostProcessor beans, * respecting explicit order if given. * <p>Must be called before singleton instantiation. */ protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory) { PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(beanFactory, getBeanFactoryPostProcessors()); // Detect a LoadTimeWeaver and prepare for weaving, if found in the meantime // (e.g. through an @Bean method registered by ConfigurationClassPostProcessor) if (beanFactory.getTempClassLoader() == null && beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) { beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory)); beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader())); } }
/** * Instantiate and invoke all registered BeanFactoryPostProcessor beans, * respecting explicit order if given. * <p>Must be called before singleton instantiation. */ protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory) { PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(beanFactory, getBeanFactoryPostProcessors()); // Detect a LoadTimeWeaver and prepare for weaving, if found in the meantime // (e.g. through an @Bean method registered by ConfigurationClassPostProcessor) if (beanFactory.getTempClassLoader() == null && beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) { beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory)); beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader())); } }
private boolean hasBeanFactoryPostProcessor(ConfigurableApplicationContext applicationContext, BeanFactoryPostProcessor beanFactoryPostProcessor) { for (BeanFactoryPostProcessor candidate : ((AbstractApplicationContext) applicationContext) .getBeanFactoryPostProcessors()) { if (candidate.getClass().equals(beanFactoryPostProcessor.getClass())) { return true; } } return false; } }
private Map<String, Class> getMockedBeans(ServerSpec serverSpec) { ServerExecutionConfiguration serverConfig = ServerExecutionRegistry.getConfiguration(serverSpec); AbstractApplicationContext remoteContext = (AbstractApplicationContext) serverConfig.getSpringContext(); List<BeanFactoryPostProcessor> postProcessors = remoteContext.getBeanFactoryPostProcessors(); for (BeanFactoryPostProcessor processor : postProcessors) { if (processor.getClass() == BeanAutoMockPostProcessor.class) { return ((BeanAutoMockPostProcessor) processor).getMockedBeans(); } } LOG.warn("No BeanAutoMockPostProcessor found in context " + serverSpec); return new HashMap<String, Class>(); }
protected void safeAddBeanScopePostProcessors( ApplicationContext appCtx ) { if( appCtx != null && appCtx instanceof AbstractApplicationContext ) { boolean beanScopePostProcessorExists = false; for( BeanFactoryPostProcessor bfpp : ( ( AbstractApplicationContext ) appCtx ).getBeanFactoryPostProcessors() ) { beanScopePostProcessorExists |= ( bfpp != null && bfpp instanceof PentahoBeanScopeValidatorPostProcessor ); } if( !beanScopePostProcessorExists ){ ( ( AbstractApplicationContext ) appCtx ).addBeanFactoryPostProcessor( new PentahoBeanScopeValidatorPostProcessor() ); } } } }
for (Object o : parentContext.getBeanFactoryPostProcessors()) { postProcessors.add((BeanFactoryPostProcessor) o);
for (Object bfpp : parent.getBeanFactoryPostProcessors()) doCopyBeanFactoryPostProcessor((BeanFactoryPostProcessor) bfpp);
/** * Instantiate and invoke all registered BeanFactoryPostProcessor beans, * respecting explicit order if given. * <p>Must be called before singleton instantiation. */ protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory) { PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(beanFactory, getBeanFactoryPostProcessors()); // Detect a LoadTimeWeaver and prepare for weaving, if found in the meantime // (e.g. through an @Bean method registered by ConfigurationClassPostProcessor) if (beanFactory.getTempClassLoader() == null && beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) { beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory)); beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader())); } }