在J2EE架构中应用Spring,为了共享WebApp的Spring Context,采用以下方法:
1、新建ContextUtil.java
























2、在applicationContext.xml中配置ContextUtil Bean,并指定Singleton作用域









3、扩展org.springframework.web.context.ContextLoaderListener


























4、修改web.xml替换org.springframework.web.context.ContextLoaderListener













5、Use like this









关于使用的问题:为什么无法将ContextUtil注入(setter)到EAR中EJB模块的Bean中?
参考: Spirng Use In Other Times