• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Aware类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Aware类属于org.springframework.beans.factory包,在下文中一共展示了Aware类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: invokeAwareMethods

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
/**
 * Invoke {@link ResourceLoaderAware}, {@link BeanClassLoaderAware} and
 * {@link BeanFactoryAware} contracts if implemented by the given {@code bean}.
 */
private void invokeAwareMethods(Object importStrategyBean) {
	if (importStrategyBean instanceof Aware) {
		if (importStrategyBean instanceof EnvironmentAware) {
			((EnvironmentAware) importStrategyBean).setEnvironment(this.environment);
		}
		if (importStrategyBean instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) importStrategyBean).setResourceLoader(this.resourceLoader);
		}
		if (importStrategyBean instanceof BeanClassLoaderAware) {
			ClassLoader classLoader = (this.registry instanceof ConfigurableBeanFactory ?
					((ConfigurableBeanFactory) this.registry).getBeanClassLoader() :
					this.resourceLoader.getClassLoader());
			((BeanClassLoaderAware) importStrategyBean).setBeanClassLoader(classLoader);
		}
		if (importStrategyBean instanceof BeanFactoryAware && this.registry instanceof BeanFactory) {
			((BeanFactoryAware) importStrategyBean).setBeanFactory((BeanFactory) this.registry);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:ConfigurationClassParser.java


示例2: invokeAwareInterfaces

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
private void invokeAwareInterfaces(Object bean) {
	if (bean instanceof Aware) {
		if (bean instanceof EnvironmentAware) {
			((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment());
		}
		if (bean instanceof EmbeddedValueResolverAware) {
			((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver(
					new EmbeddedValueResolver(this.applicationContext.getBeanFactory()));
		}
		if (bean instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext);
		}
		if (bean instanceof ApplicationEventPublisherAware) {
			((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext);
		}
		if (bean instanceof MessageSourceAware) {
			((MessageSourceAware) bean).setMessageSource(this.applicationContext);
		}
		if (bean instanceof ApplicationContextAware) {
			((ApplicationContextAware) bean).setApplicationContext(this.applicationContext);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:ApplicationContextAwareProcessor.java


示例3: invokeAwareInterfaces

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
/**��beanʵ�ֵ�aware�������лص�
 * @param bean
 */
private void invokeAwareInterfaces(Object bean) {
	if (bean instanceof Aware) {
		if (bean instanceof EnvironmentAware) {
			((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment());
		}
		if (bean instanceof EmbeddedValueResolverAware) {
			((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver(
					new EmbeddedValueResolver(this.applicationContext.getBeanFactory()));
		}
		if (bean instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext);
		}
		if (bean instanceof ApplicationEventPublisherAware) {
			((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext);
		}
		if (bean instanceof MessageSourceAware) {
			((MessageSourceAware) bean).setMessageSource(this.applicationContext);
		}
		if (bean instanceof ApplicationContextAware) {
			((ApplicationContextAware) bean).setApplicationContext(this.applicationContext);
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:27,代码来源:ApplicationContextAwareProcessor.java


示例4: invokeAwareMethods

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
/**
 * Invoke {@link ResourceLoaderAware}, {@link BeanClassLoaderAware} and
 * {@link BeanFactoryAware} contracts if implemented by the given {@code filter}.
 */
private void invokeAwareMethods(TypeFilter filter) {
	if (filter instanceof Aware) {
		if (filter instanceof EnvironmentAware) {
			((EnvironmentAware) filter).setEnvironment(this.environment);
		}
		if (filter instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) filter).setResourceLoader(this.resourceLoader);
		}
		if (filter instanceof BeanClassLoaderAware) {
			ClassLoader classLoader = (this.registry instanceof ConfigurableBeanFactory ?
					((ConfigurableBeanFactory) this.registry).getBeanClassLoader() :
					this.resourceLoader.getClassLoader());
			((BeanClassLoaderAware) filter).setBeanClassLoader(classLoader);
		}
		if (filter instanceof BeanFactoryAware && this.registry instanceof BeanFactory) {
			((BeanFactoryAware) filter).setBeanFactory((BeanFactory) this.registry);
		}
	}
}
 
开发者ID:txazo,项目名称:spring,代码行数:24,代码来源:ComponentScanAnnotationParser.java


示例5: invokeAwareInterfaces

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
private void invokeAwareInterfaces(Object bean) {
	if (bean instanceof Aware) {
		if (bean instanceof EnvironmentAware) {
			((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment());
		}
		if (bean instanceof EmbeddedValueResolverAware) {
			((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver(this.embeddedValueResolver);
		}
		if (bean instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext);
		}
		if (bean instanceof ApplicationEventPublisherAware) {
			((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext);
		}
		if (bean instanceof MessageSourceAware) {
			((MessageSourceAware) bean).setMessageSource(this.applicationContext);
		}
		if (bean instanceof ApplicationContextAware) {
			((ApplicationContextAware) bean).setApplicationContext(this.applicationContext);
		}
	}
}
 
开发者ID:txazo,项目名称:spring,代码行数:23,代码来源:ApplicationContextAwareProcessor.java


示例6: invokeAwareMethods

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
/**
 * Invoke {@link EnvironmentAware}, {@link ResourceLoaderAware}, {@link BeanClassLoaderAware}
 * and {@link BeanFactoryAware} contracts if implemented by the given {@code registrar}.
 */
private void invokeAwareMethods(ImportBeanDefinitionRegistrar registrar) {
	if (registrar instanceof Aware) {
		if (registrar instanceof EnvironmentAware) {
			((EnvironmentAware) registrar).setEnvironment(this.environment);
		}
		if (registrar instanceof ResourceLoaderAware) {
			((ResourceLoaderAware) registrar).setResourceLoader(this.resourceLoader);
		}
		if (registrar instanceof BeanClassLoaderAware) {
			ClassLoader classLoader = (this.registry instanceof ConfigurableBeanFactory ?
					((ConfigurableBeanFactory) this.registry).getBeanClassLoader() :
					this.resourceLoader.getClassLoader());
			((BeanClassLoaderAware) registrar).setBeanClassLoader(classLoader);
		}
		if (registrar instanceof BeanFactoryAware && this.registry instanceof BeanFactory) {
			((BeanFactoryAware) registrar).setBeanFactory((BeanFactory) this.registry);
		}
	}
}
 
开发者ID:lindzh,项目名称:mybatis-spring-1.2.2,代码行数:24,代码来源:ConfigurationClassParser.java


示例7: invokeAwareMethods

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
private void invokeAwareMethods(final String beanName, final Object bean) {
	if (bean instanceof Aware) {
		if (bean instanceof BeanNameAware) {
			((BeanNameAware) bean).setBeanName(beanName);
		}
		if (bean instanceof BeanClassLoaderAware) {
			((BeanClassLoaderAware) bean).setBeanClassLoader(getBeanClassLoader());
		}
		if (bean instanceof BeanFactoryAware) {
			((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AbstractAutowireCapableBeanFactory.java


示例8: invokeAwareInterfaces

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
protected void invokeAwareInterfaces(Object bean) {
	if (bean instanceof Aware) {
		//扩展 DisruptorEventPublisherAware
		if (bean instanceof DisruptorEventPublisherAware) {
			DisruptorEventPublisherAware awareBean = (DisruptorEventPublisherAware) bean;  
			awareBean.setDisruptorEventPublisher( this.disruptorContext );
		}
	}
}
 
开发者ID:vindell,项目名称:spring-boot-starter-disruptor,代码行数:10,代码来源:DisruptorEventAwareProcessor.java


示例9: injectComponentAware

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
private void injectComponentAware(Object instance){
	if(instance instanceof Aware){
		if(instance instanceof PluginContextAware){
			((PluginContextAware)instance).setPluginContext(pluginContext);
		}
		if(instance instanceof ApplicationContextAware){
			((ApplicationContextAware)instance).setApplicationContext(pluginContext.getApplicationContext());
		}
	}
}
 
开发者ID:balancebeam,项目名称:puzzle,代码行数:11,代码来源:PluginServletManager.java


示例10: invokeAwareInterfaces

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
private void invokeAwareInterfaces(Object bean) {

        if ( bean instanceof Aware ) {

            if ( bean instanceof VaadinSecurityAware ) {
                ((VaadinSecurityAware) bean).setVaadinSecurity(this.applicationContext.getBean(VaadinSecurity.class));
            }

            if ( bean instanceof VaadinSecurityContextAware ) {
                ((VaadinSecurityContextAware) bean).setVaadinSecurityContext(this.applicationContext.getBean(VaadinSecurityContext.class));
            }
        }

    }
 
开发者ID:peholmst,项目名称:vaadin4spring,代码行数:15,代码来源:VaadinSecurityAwareProcessor.java


示例11: isConfigurationCallbackInterface

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
/**
 * Determine whether the given interface is just a container callback and
 * therefore not to be considered as a reasonable proxy interface.
 * <p>If no reasonable proxy interface is found for a given bean, it will get
 * proxied with its full target class, assuming that as the user's intention.
 * @param ifc the interface to check
 * @return whether the given interface is just a container callback
 */
protected boolean isConfigurationCallbackInterface(Class<?> ifc) {
	return (ifc.equals(InitializingBean.class) || ifc.equals(DisposableBean.class) ||
			ObjectUtils.containsElement(ifc.getInterfaces(), Aware.class));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AbstractAutoProxyCreator.java


示例12: isConfigurationCallbackInterface

import org.springframework.beans.factory.Aware; //导入依赖的package包/类
/**
 * Determine whether the given interface is just a container callback and
 * therefore not to be considered as a reasonable proxy interface.
 * <p>If no reasonable proxy interface is found for a given bean, it will get
 * proxied with its full target class, assuming that as the user's intention.
 * @param ifc the interface to check
 * @return whether the given interface is just a container callback
 */
protected boolean isConfigurationCallbackInterface(Class<?> ifc) {
	return (InitializingBean.class == ifc || DisposableBean.class == ifc ||
			ObjectUtils.containsElement(ifc.getInterfaces(), Aware.class));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:ProxyProcessorSupport.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TemplateRegistrations类代码示例发布时间:2022-05-22
下一篇:
Java ExtractExpression类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap