How to get ServletContext and ServletConfig object in a Spring Bean

Introduction ServletConfig is used by only single servlet to get configuration information, whereas ServletContext is used by multiple objects to get configuration information. ServletConfig object is one per servlet class and destroyed once the servlet execution is completed. ServletConfig object gets created during initialization process of the servlet and this object is public to a particular servlet only.