Answer the question
In order to leave comments, you need to log in
java application context. is it possible to figure this out?
Good afternoon, dear developers
I'm trying to understand the concept of the context of a java application, I looked at various explanations on the Internet, but they confuse more than clarify. Please let me know if I'm wrong in my understanding. can you have clear interface definitions?
take for example one of the definitions "once the idea arose that everything should have a name (in the form of a string). In order to access an object by name, it is necessary to have some interface, namely, Context. That is, the context is an interface, which allows you to get an object for a given string. "
From the quote, it is generally not clear why the need to create contexts arose at all and what is the real advantage of their use. why do you need a name as a string. at what here the interface to gaining access? as I understand it, access can be obtained through a specific object of the interface type, and not through the interface itself.
Answer the question
In order to leave comments, you need to log in
And instead of the Reflection API, I see a specific Spring, with its IoC. So what is context. Well application it basically also is a context (ApplicationContext). And this context (container, etc.) can give you some object (Bean) by name. Those. at the start of the application (context), this application (context) scans the classpath for the presence of objects that it can operate on (Bean's), which is why it knows all of them by name, and can give them to you by these names. Of course there are nuances, but in short, that's all. And yes, it works through the Reflection API.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question