xdxxdx
www.xdxxdxxdx.com
摘要: 起因是我想要获取一个相对路径,需要用到servletContext的getRealPath()方法,于是上网搜索,找到两种方法来获取ServletContext. 方法1:第一种方法是这样的: ServletActionContext.getServletContext(); 或者ServletCo 阅读全文
posted @ 2017-02-03 17:39 xdxxdx 阅读(14750) 评论(0) 推荐(1) 编辑
摘要: 在很多情况,我们需要先获取spring容器上下文,即webApplicationContext,然后通过webApplicationContext来获取其中的bean。典型的情况是,我想在一个并未委托给spring容器管理的对象里,去引用一个spring容器管理的对象,此时,@Resource注解是 阅读全文
posted @ 2017-02-03 12:02 xdxxdx 阅读(1503) 评论(0) 推荐(0) 编辑