Preface:

Daily development will always see the context of the three words, application context, execution context, process context and so on, at the beginning of the three words actually do not feel special, just like ordinary eating and sleeping just do not think about it.

Then one day, a terrible thought came to me:

What exactly is an application context?

??????????

I was just like when I got up in the morning. I looked around, my eyes full of doubt and confusion. The three words in the context were like a shadow in a fog.

Think of here, the in the mind can not help but sigh, Chinese culture extensive and profound.

Perhaps I have never known this knowledge before, so I asked my friends around me what is context

??????????

You know, context, you know, context, it’s a very common concept. Sorry, poof, I remember something funny.

So a ball of wool in my mind with deep doubt hope in Baidu, in an attempt to find the true meaning of Java programming between the lines.

Context, that is, context, meaning, is the concept of language disciplines (linguistics, sociolinguistics, discourse analysis, pragmatics, semiotics, etc.). Semantic analysis technology refers to analyzing a long string of words or content to get the summary and general idea of the paragraph, or even further, to sort out the meaning of the whole article. This technology can be applied in the interpretation of films, audio and other files, so that the search engine can search beyond the text of the object, convenient users save a lot of time to watch films, listen to audio and video, but also help users to understand the content of the film and audio in advance.

I, %#¥…… ¥¥#¥@#%¥¥%…… # $# @

So what is context and what role does it play in programming? With this question in mind, I embarked on a long journey to find the answer. Finally, god paid off, I still did not find a specific explanation.

Well, today hair article end here, although the above said a lot of nonsense, like a lot of things no longer below.

Wait, you just said above, right? You said below, right?

Yeah, well, isn’t that all context?

Oh my god

Context, therefore, is a representative of the overall environment, for example this article, we can say below, access to the content of the statement below, also can say in this paper, access to the contents of the above, and we each paragraph of the article on behalf of the meaning of all is according to the context of us to decide, Because the meaning of a sentence you pick up without considering the overall context will not be accurate, therefore, the context of this article is the central idea of our whole article.

For example, such as our data source in the Spring, is stored in the context, this time, whether it is where the code, can be get from context related to the data connection and for operation, in the same way, we can in any place by a Spring context to bean and other configuration information, of course, Anywhere here is where we are after Spring initialization is done.

The context usually refers to the context in which we are running, for example, the same break statement in the if for statement is not the same as that in the switch statement. Of course it didn’t, it was the context that it was in that changed, the context that it was in.

Again like we used to switch from the thread, the thread before switching state information is temporarily stored in the register of the context including the register values at the time, the value of the register are saved, while waiting for the next time the thread is CPU time again to restore the value of the register, such threads can run correctly.

Until now, I found that my thinking is not much clear, but I have a general understanding of the context

Context, which represents the current running environment of the program, relates to your entire app life cycle and resource invocation, and is the sum of all resources accessible to the program. Resource can be a variable or a reference to an object.

This is probably my understanding of the context, if you have different understanding, feel free to leave a comment at the bottom of this article.

I am Han Shu, pay attention to me, there are good fruit to eat ~

So, what exactly is context?