1 16 17 package org.springframework.web.context.support; 18 19 import javax.servlet.ServletContext ; 20 21 import org.springframework.beans.factory.FactoryBean; 22 import org.springframework.web.context.ServletContextAware; 23 24 43 public class ServletContextFactoryBean implements FactoryBean, ServletContextAware { 44 45 private ServletContext servletContext; 46 47 48 public void setServletContext(ServletContext servletContext) { 49 this.servletContext = servletContext; 50 } 51 52 53 public Object getObject() { 54 return this.servletContext; 55 } 56 57 public Class getObjectType() { 58 return (this.servletContext != null ? this.servletContext.getClass() : ServletContext .class); 59 } 60 61 public boolean isSingleton() { 62 return true; 63 } 64 65 } 66 | Popular Tags |