关于ApplicationContextAware 的问题
来源:互联网 发布:怎么用模拟器登录淘宝 编辑:程序博客网 时间:2024/05/20 07:52
加载Spring配置文件时,如果Spring配置文件中所定义的Bean类实现了ApplicationContextAware 接口,那么在加载Spring配置文件时,会自动调用ApplicationContextAware 接口中的
class xxxx implements ApplicationContextAware{
private static ApplicationContext applicationContext;
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
}
}
<bean id="xxxxxx" class="xxxxxxx"></bean>
方法,获得ApplicationContext对象
public static Object getBean(String beanId) {
return applicationContext.getBean(beanId);
}
在spring 配置文件里面要配置要用getBean获取的id
<bean id="commentService"
class="com.excellence.exoa.cms.service.impl.CommentServiceImpl">
</bean>
- 关于ApplicationContextAware 的问题
- 关于ApplicationContextAware
- Spring的@PostConstruct与ApplicationContextAware冲突问题
- ApplicationContextAware学习--存疑问题
- ApplicationContextAware的使用
- Spring的ApplicationContextAware解析
- ApplicationContextAware的理解
- Spring的ApplicationContextAware解析
- ApplicationContextAware接口的作用
- ApplicationContextAware的使用
- ApplicationContextAware接口的使用
- ApplicationContextAware接口的作用
- ApplicationContextAware接口的作用
- ApplicationContextAware的用法
- ApplicationContextAware的使用原理
- ApplicationContextAware
- ApplicationContextAware
- ApplicationContextAware
- ant: ant-flaka.jar 注释符号;
- Hadoop的map、block、split关系
- 企业IT移动化方案:微信+OA!
- V4L2应用程序框架
- 设计模式(行为型)之备忘录模式(Memento Pattern)
- 关于ApplicationContextAware 的问题
- hello world
- hadoop2.6 每次重启linux 都必须重新format datanode的问题
- mongodb问题汇总和技术连接
- 密匙二
- Ubuntu15.x /CentOS 7.x 以后 设置开机启动,添加自定义系统服务,自定义开机启动
- C语言算法之老鼠走迷宫
- v4l2
- 好用原型設計軟體 Mockplus 免費畫互動 App 與網頁