程序运行过程中获取Spring上下文通过ApplicationContextAware
来源:互联网 发布:电脑数据迁移 编辑:程序博客网 时间:2024/06/05 18:32
public class SpringContextUtil implements ApplicationContextAware { private static ApplicationContext applicationContext; @Override public final void setApplicationContext(ApplicationContext arg0) throws BeansException { SpringContextUtil.applicationContext = arg0; } public final static ApplicationContext getApplicationContext() { return applicationContext; } public final static Object getBean(Class clazz) throws BeansException { return applicationContext.getBean(clazz); } public final static Object getBean(String name) throws BeansException { return applicationContext.getBean(name); }}
spring-mvc.xml配置
<bean id="springContextUtil" class="com.enci.isms.common.utils.SpringContextUtil"></bean>
阅读全文
0 0
- 程序运行过程中获取Spring上下文通过ApplicationContextAware
- ApplicationContextAware 获取Spring 上下文
- Spring ApplicationContextAware获取上下文
- Spring ApplicationContextAware获取上下文
- 通过ApplicationContextAware加载Spring上下文环境(获取bean)
- 通过ApplicationContextAware加载Spring上下文环境
- 通过ApplicationContextAware加载Spring上下文环境
- 通过ApplicationContextAware加载Spring上下文环境
- 通过ApplicationContextAware加载Spring上下文环境
- 通过ApplicationContextAware加载Spring上下文环境
- 通过ApplicationContextAware加载Spring上下文环境
- Spring,通过ApplicationContextAware获取ApplicationContext
- ApplicationContextAware获取Spring上下文,通过基类获取properties中的配置属性
- Spring中通过实现ApplicationContextAware接口获取bean
- ApplicationContextAware获取上下文bean
- 通过ApplicationContextAware获取spring容器中的bean
- 通过ApplicationContextAware获取spring容器中的bean
- Spring中ApplicationContextAware实现获取bean的工具类,在servlet中通过servletContext获取application
- 插件导致的idea卡在启动界面
- python3.6 安装Twisted出错怎么办
- Remove saved credentials from TortoiseGit
- 深入分析js中的prototype,_proto_,constructor
- Android开发基本环境搭建——IDE
- 程序运行过程中获取Spring上下文通过ApplicationContextAware
- Tomcat 7.0 在centOS 6.9的安装
- Linux introduce
- datetime.datetime() is not JSON serializable
- 【deeplearning.ai】Neural Networks and Deep Learning——逻辑斯特回归
- JAVA实现排列组合
- Java分布式应用技术架构介绍
- anaconda3+keras + theano/tensorflow的安装和测试
- update