The concept of context, in a broad sense, usually means the environment of an object. For example, if there is an object, then in the course of the application operation it will interact with other objects, have access to configuration parameters, variables, depend on the state of other objects, or exist within the life cycle. Global and local variables, environment variables, interacting with a given object, their state, etc., etc. - all together form the context of the object - the environment with which it works. Those. context is the execution / runtime environment of the object as a whole.
ServletContext is an object that contains the configuration of your application. It is also the interface between the servlet and the servlet container. ServletContext creates web applications at the start, allows servlets and JSPs to access the configuration parameters described in web.xml, as well as exchange data within the application.
For example, it can be used to obtain a log file. There is one context for the Java Virtual Machine.
In Spring, an object similar in meaning, but more voluminous in scope, is called an ApplicationContext , which is more specific in the definition of the functions it performs.
Similarly, a query context is a collection of parameters and runtime environment that are available for a given query. For example, request-related attributes and HTTP headers.
The context of a web application is essentially the web application itself at runtime.