The objects that form the backbone of your application and that are
managed by the Spring IoC container are called beans. A bean is an
object that is instantiated, assembled, and otherwise managed by a
Spring IoC container. These beans are created with the configuration
metadata that you supply to the container, for example, in the form of
More to learn about beans and scope from SpringSource:
When you create a bean definition what you are actually creating is a
recipe for creating actual instances of the class defined by that bean
definition. The idea that a bean definition is a recipe is important,
because it means that, just like a class, you can potentially have
many object instances created from a single recipe.
You can control not only the various dependencies and configuration
values that are to be plugged into an object that is created from a
particular bean definition, but also the scope of the objects created
from a particular bean definition. This approach is very powerful and
gives you the flexibility to choose the scope of the objects you
create through configuration instead of having to 'bake in' the scope
of an object at the Java class level. Beans can be defined to be
deployed in one of a number of scopes
So these are objects that the container manages and I don't have to touch, but if I want access to a bean to maybe call some methods or retrieve properties, then I can "ask" Spring for the bean?
@grantmc It's sort of like that, except the inversion of control thing is supposed to be understood as the contrary of "ask": instead of "asking" for things, you "declare" that you'll need it. And then, when you startup the app, the framework will check all declarations and set the appropriate instance.
@elias How do I declare that I need it? Is it when I'm using @Autowired? Or simply when I do my imports?
It would be helpful to define what IoC means for Spring newcomers.