`
hjy2099
  • 浏览: 255869 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

从Spring的Bean中获取servletcontext 和 applicationContext

阅读更多
import javax.servlet.ServletContext;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.ServletContextAware;

/**
 * @作者 黄嘉寅
 * @功能 客户端与服务端数据传输接口
 * @日期 2008-8-28
 */
public class SysInterface implements ApplicationContextAware,ServletContextAware{
 
 /** 
  * 功能 : 实现 ApplicationContextAware接口,由Spring自动注入 Spring上下文对象
  * 
  **/
 public void setApplicationContext(ApplicationContext actx)   throws BeansException 
 {
  }

 /** 
  * 功能 : 实现 ServletContextAware接口,由Spring自动注入 系统上下文对象
  * 
  **/
 public void setServletContext(ServletContext sctx) 
 { 
}
}

 

分享到:
评论

相关推荐

    Spring-Reference_zh_CN(Spring中文参考手册)

    5.4.1. 设置和获取属性值以及嵌套属性 5.4.2. 内建的PropertyEditor实现 5.4.2.1. 注册用户自定义的PropertyEditor 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 ...

    Spring中文帮助文档

    5.4.1. 设置和获取属性值以及嵌套属性 5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. AOP代理 6.2. @AspectJ支持 ...

    spring源代码解析

    从加载过程我们可以看到,首先从Servlet事件中得到ServletContext,然后可以读到配置好的在web.xml的中的各个属性值,然后ContextLoder实例化WebApplicationContext并完成其载入和初始化作为根上下文。当这个根上...

    Spring 2.0 开发参考手册

    5.4.1. 设置和获取属性值以及嵌套属性 5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. Spring的AOP代理 6.2. @...

    Spring API

    5.4.1. 设置和获取属性值以及嵌套属性 5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. AOP代理 6.2. @AspectJ支持 ...

    spring chm文档

    5.4.1. 设置和获取属性值以及嵌套属性 5.4.2. 内建的PropertyEditor实现 6. 使用Spring进行面向切面编程(AOP) 6.1. 简介 6.1.1. AOP概念 6.1.2. Spring AOP的功能和目标 6.1.3. Spring的AOP代理 6.2. @...

    Struts2+Spring3+MyBatis3完整实例

    网上的东西好大多都不能直接用,自己结合网上资料做了一个Struts2+Spring3+MyBatis3的测试工程,JUnit测试用例和WEB服务。 内涵完整jar包,解压直接可用,包括一个表文件。 Eclipse3.2+Tomcat/5.5+jdk1.5.0_17 - ...

    在action以外的地方获取dao

    这是在action以外的地方拿ApplicationContext的方法,需要的参数是:ServletContext,在request.getServletContext里能拿到,所以只要有request就能拿到spring配置文件里的bean. 这种方法通常在写组件时用,比如写...

    SPRING API 2.0.CHM

    ApplicationContext ApplicationContextAware ApplicationContextAwareProcessor ApplicationContextException ApplicationEvent ApplicationEventMulticaster ApplicationEventPublisher ...

    S2SH整合报错

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed;...

    spring-framework-reference-4.1.2

    Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans .......................................................................................

    spring-framework-reference4.1.4

    Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans .......................................................................................

Global site tag (gtag.js) - Google Analytics