java - SSM框架中如何获取ApplicationContext

查看:322
本文介绍了java - SSM框架中如何获取ApplicationContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

我搭建了一个SSM框架的Web项目,Spring的配置文件我在web.xml中加载了,我想在程序中获得ApplicationContext对象,如何获取,尽可能不要通过指定配置文件路径的方式去获取。
附上配置文件:
applicationContext-Dao.xml:

applicationContext-Service.xml:

applicationContext-Transaction.xml:

web.xml:

获取applicationContext的代码:


第14行需要获取到applicationContext,请问怎么获取

解决方案

实现ApplicationContextAware接口

这篇关于java - SSM框架中如何获取ApplicationContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆