当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurableListableBeanFactory.addBeanPostProcessor方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.config.ConfigurableListableBeanFactory.addBeanPostProcessor方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableListableBeanFactory.addBeanPostProcessor方法的具体用法?Java ConfigurableListableBeanFactory.addBeanPostProcessor怎么用?Java ConfigurableListableBeanFactory.addBeanPostProcessor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.config.ConfigurableListableBeanFactory的用法示例。


在下文中一共展示了ConfigurableListableBeanFactory.addBeanPostProcessor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postProcessBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
	beanFactory.ignoreDependencyInterface(ServletContextAware.class);
	beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
	WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AbstractRefreshableWebApplicationContext.java

示例2: postProcessBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
/**
 * Register ServletContextAwareProcessor.
 * @see ServletContextAwareProcessor
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
	beanFactory.ignoreDependencyInterface(ServletContextAware.class);

	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
	WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:GenericWebApplicationContext.java

示例3: postProcessBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
public void postProcessBeanFactory(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory)
		throws BeansException, OsgiException {

	Bundle bundle = bundleContext.getBundle();
	try {
		// Try and load the annotation code using the bundle classloader
		Class<?> annotationBppClass = bundle.loadClass(ANNOTATION_BPP_CLASS);
		// instantiate the class
		final BeanPostProcessor annotationBeanPostProcessor = (BeanPostProcessor) BeanUtils.instantiateClass(annotationBppClass);

		// everything went okay so configure the BPP and add it to the BF
		((BeanFactoryAware) annotationBeanPostProcessor).setBeanFactory(beanFactory);
		((BeanClassLoaderAware) annotationBeanPostProcessor).setBeanClassLoader(beanFactory.getBeanClassLoader());
		((BundleContextAware) annotationBeanPostProcessor).setBundleContext(bundleContext);
		beanFactory.addBeanPostProcessor(annotationBeanPostProcessor);
	}
	catch (ClassNotFoundException exception) {
		log.info("Spring-DM annotation package could not be loaded from bundle ["
				+ OsgiStringUtils.nullSafeNameAndSymName(bundle) + "]; annotation processing disabled...");
		if (log.isDebugEnabled())
			log.debug("Cannot load annotation injection processor", exception);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:24,代码来源:OsgiAnnotationPostProcessor.java

示例4: enforceExporterImporterDependency

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
/**
 * Takes care of enforcing the relationship between exporter and importers.
 * 
 * @param beanFactory
 */
private void enforceExporterImporterDependency(ConfigurableListableBeanFactory beanFactory) {
	Object instance = null;

	instance = AccessController.doPrivileged(new PrivilegedAction<Object>() {

		public Object run() {
			// create the service manager
			ClassLoader loader = AbstractOsgiBundleApplicationContext.class.getClassLoader();
			try {
				Class<?> managerClass = loader.loadClass(EXPORTER_IMPORTER_DEPENDENCY_MANAGER);
				return BeanUtils.instantiateClass(managerClass);
			} catch (ClassNotFoundException cnfe) {
				throw new ApplicationContextException("Cannot load class " + EXPORTER_IMPORTER_DEPENDENCY_MANAGER,
						cnfe);
			}
		}
	});

	// sanity check
	Assert.isInstanceOf(BeanFactoryAware.class, instance);
	Assert.isInstanceOf(BeanPostProcessor.class, instance);
	((BeanFactoryAware) instance).setBeanFactory(beanFactory);
	beanFactory.addBeanPostProcessor((BeanPostProcessor) instance);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:AbstractOsgiBundleApplicationContext.java

示例5: postProcessBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
		throws BeansException {
	OAuth2ExpressionHandlerInjectionPostProcessor processor = new OAuth2ExpressionHandlerInjectionPostProcessor(
			this.applicationContext);
	beanFactory.addBeanPostProcessor(processor);
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:8,代码来源:OAuth2MethodSecurityConfiguration.java

示例6: postProcessBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	super.postProcessBeanFactory(beanFactory);

	beanFactory.addBeanPostProcessor(new BundleContextAwareProcessor(this.bundleContext));
	beanFactory.ignoreDependencyInterface(BundleContextAware.class);

	if (beanFactory instanceof AbstractBeanFactory) {
		AbstractBeanFactory bf = (AbstractBeanFactory) beanFactory;
		bf.setSecurityContextProvider(new SecurityContextProvider() {

			public AccessControlContext getAccessControlContext() {
				return acc;
			}
		});
	}

	enforceExporterImporterDependency(beanFactory);

	// add predefined beans
	// bundleContext
	addPredefinedBean(beanFactory, BUNDLE_CONTEXT_BEAN_NAME, this.bundleContext);
	addPredefinedBean(beanFactory, BUNDLE_BEAN_NAME, this.bundle);

	// register property editors
	registerPropertyEditors(beanFactory);

	// register a 'bundle' scope
	beanFactory.registerScope(OsgiBundleScope.SCOPE_NAME, new OsgiBundleScope());
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:AbstractOsgiBundleApplicationContext.java

示例7: registerBeanPostProcessors

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
/**
 * Register the given BeanPostProcessor beans.
 */
private void registerBeanPostProcessors(ConfigurableListableBeanFactory beanFactory,
		List<BeanPostProcessor> postProcessors) {

	for (BeanPostProcessor postProcessor : postProcessors) {
		beanFactory.addBeanPostProcessor(postProcessor);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:11,代码来源:AbstractDelegatedExecutionApplicationContext.java

示例8: prepareBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
/**
 * Configure the factory's standard context characteristics,
 * such as the context's ClassLoader and post-processors.
 * @param beanFactory the BeanFactory to configure
 */
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	// Tell the internal bean factory to use the context's class loader etc.
	beanFactory.setBeanClassLoader(getClassLoader());
	beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver());
	beanFactory.addPropertyEditorRegistrar(new ResourceEditorRegistrar(this, getEnvironment()));

	// Configure the bean factory with context callbacks.
	beanFactory.addBeanPostProcessor(new ApplicationContextAwareProcessor(this));
	beanFactory.ignoreDependencyInterface(ResourceLoaderAware.class);
	beanFactory.ignoreDependencyInterface(ApplicationEventPublisherAware.class);
	beanFactory.ignoreDependencyInterface(MessageSourceAware.class);
	beanFactory.ignoreDependencyInterface(ApplicationContextAware.class);
	beanFactory.ignoreDependencyInterface(EnvironmentAware.class);

	// BeanFactory interface not registered as resolvable type in a plain factory.
	// MessageSource registered (and found for autowiring) as a bean.
	beanFactory.registerResolvableDependency(BeanFactory.class, beanFactory);
	beanFactory.registerResolvableDependency(ResourceLoader.class, this);
	beanFactory.registerResolvableDependency(ApplicationEventPublisher.class, this);
	beanFactory.registerResolvableDependency(ApplicationContext.class, this);

	// Detect a LoadTimeWeaver and prepare for weaving, if found.
	if (beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
		beanFactory.addBeanPostProcessor(new LoadTimeWeaverAwareProcessor(beanFactory));
		// Set a temporary ClassLoader for type matching.
		beanFactory.setTempClassLoader(new ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader()));
	}

	// Register default environment beans.
	if (!beanFactory.containsLocalBean(ENVIRONMENT_BEAN_NAME)) {
		beanFactory.registerSingleton(ENVIRONMENT_BEAN_NAME, getEnvironment());
	}
	if (!beanFactory.containsLocalBean(SYSTEM_PROPERTIES_BEAN_NAME)) {
		beanFactory.registerSingleton(SYSTEM_PROPERTIES_BEAN_NAME, getEnvironment().getSystemProperties());
	}
	if (!beanFactory.containsLocalBean(SYSTEM_ENVIRONMENT_BEAN_NAME)) {
		beanFactory.registerSingleton(SYSTEM_ENVIRONMENT_BEAN_NAME, getEnvironment().getSystemEnvironment());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:AbstractApplicationContext.java

示例9: registerBeanPostProcessors

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
/**
 * Register the given BeanPostProcessor beans.
 */
private static void registerBeanPostProcessors(
		ConfigurableListableBeanFactory beanFactory, List<BeanPostProcessor> postProcessors) {

	for (BeanPostProcessor postProcessor : postProcessors) {
		beanFactory.addBeanPostProcessor(postProcessor);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:PostProcessorRegistrationDelegate.java

示例10: postProcessBeanFactory

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; //导入方法依赖的package包/类
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	beanFactory.addBeanPostProcessor(new BootstrapContextAwareProcessor(this.bootstrapContext));
	beanFactory.ignoreDependencyInterface(BootstrapContextAware.class);
	beanFactory.registerResolvableDependency(BootstrapContext.class, this.bootstrapContext);

	// JCA WorkManager resolved lazily - may not be available.
	beanFactory.registerResolvableDependency(WorkManager.class, new ObjectFactory<WorkManager>() {
		@Override
		public WorkManager getObject() {
			return bootstrapContext.getWorkManager();
		}
	});
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:ResourceAdapterApplicationContext.java


注:本文中的org.springframework.beans.factory.config.ConfigurableListableBeanFactory.addBeanPostProcessor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。