How is it correct:
"Spring is in general a container, which manages objects..."
or
"Spring uses/contains a container, which manages objects...."
I mean, the IoC Container is PART of the Spring Framework, right? Or could you say, Spring IS开发者_运维问答 a container?
Thanks :-)
[Spring Framework 3.0.5]
Spring is a Framework that follows the Inversion of Control paradigm. Inversion of Control is a principle (the implementation details do not matter) -- the "inversion" is when you wire up your beans outside of the code, in the configuration. There are many ways to do that. An analogy would be Object Oriented programming. Object Oriented is a paradigm, just like IoC, with many ways to do it. Just like with OO, there are details that you should know, but the paradigm exists at a higher level.
Spring is a Framework because it includes a lot of libraries to make your life easier. Here the details matter; you need to know how JmsTemplate or the TransactionTemplate work to use them.
Your question is primarily about the best words to use when describing Spring, which is a valuable question. Now look at this picture, taken from here.
First, the high level words include FRAMEWORK. There is also a logical part of the application called the container, that is further divided into its components. The documentation for the container is here. When people talk about Spring, they primarily say its a framework and an IoC container, depending on how they use it. Perhaps it is accurate to say Spring is a Framework that includes an IoC container.
The important thing is you can use parts of the Spring Framework that have nothing to do with IoC , just the IoC part, or both.
精彩评论